Perl's GUI

Discussion in 'Perl Misc' started by Davy, Aug 26, 2006.

  1. Davy

    Davy Guest

    Hi all,

    I want to choose a GUI for my Perl program. Someone tell me there is
    Perl/Tk and easy to use. But I found the latest version of Perl/Tk is
    released on 11 Apr 2004. Does it mean Perl/Tk is mature and no update
    for a long time or other?

    And is there any other good choice for Perl's GUI?

    Thanks!
    Davy
     
    Davy, Aug 26, 2006
    #1
    1. Advertising

  2. Davy

    zentara Guest

    On 26 Aug 2006 04:20:04 -0700, "Davy" <> wrote:

    >Hi all,
    >
    >I want to choose a GUI for my Perl program. Someone tell me there is
    >Perl/Tk and easy to use. But I found the latest version of Perl/Tk is
    >released on 11 Apr 2004. Does it mean Perl/Tk is mature and no update
    >for a long time or other?


    Tk will be the easiset for you to get going. The basics concepts of
    writing a Tk program has not changed since 2004. There have been
    bug-fixes in Tk since then, but Nick Ing-Simmons has left applying
    the bug fix patches to the end users. He may be waiting to see how
    they all work out, before issuing a new Tk version level.
    Many are dissapointed by this, but it is not a "show-stopper". The only
    bug which I absolutely had to patch, was one where Gtk2 apps were
    crashing Tk apps. You can check the Tk buglist for details.

    >And is there any other good choice for Perl's GUI?


    Perl/Tk is based on Tcl/TK, and the 804.27 version level represents
    the latest port. You might want to look at http://www.tcl.tk/ as an
    alternative. Perl/Tk is for people who like Perl as there basic
    language, but you might like Tcl.


    The other real competitor is Perl/Gtk2. Perl/Gtk2 has had the
    advantage of being built from the ground up with a consistent
    object model, and widget design policies. WxPerl is based on
    Perl/Gtk2.

    The biggest complaint about Tk, is that it is a big hodgepodge
    of independent widgets, whearas Gtk2 is all based on Glib objects.
    This dosn't sound too important yet, but it becomes so when you
    try to sub-class objects and control signalling between them.

    Now for the bad news. Perl/Gtk2 can make it very difficult to do
    what is simple in Tk. The most obvious thing is colorization of
    widgets. Gtk2 has a powerful "theme" system, so you can make all your
    apps look like your other Gtk2 apps like mozilla. BUT, that same theme
    system, makes it quite difficult to give custom colors and fonts to
    individual widgets.
    Tk dosn't have that problem.

    Use Tk. It will be easier for you to get your app up and running.
    Afterwards, you can port it to Gtk2 or WxWidgets and compare
    how easy it was to write.



    --
    I'm not really a human, but I play one on earth.
    http://zentara.net/japh.html
     
    zentara, Aug 26, 2006
    #2
    1. Advertising

  3. Davy

    Ben Morrow Guest

    Quoth zentara <>:
    >
    > WxPerl is based on Perl/Gtk2.


    No it isn't. wxPerl is a Perl binding for the wxWidgets toolkit, which
    is a cross-platform GUI. It can be built to use Gtk; it can also use
    Motif or raw X11 under unix, and native gui widgets under Max OS X and
    Win32.

    It's biggest disadvantage is that the Perl bindings are not very well
    documented, and you end up having to translate from the C++ docs.

    > Now for the bad news. Perl/Gtk2 can make it very difficult to do
    > what is simple in Tk. The most obvious thing is colorization of
    > widgets. Gtk2 has a powerful "theme" system, so you can make all your
    > apps look like your other Gtk2 apps like mozilla. BUT, that same theme
    > system, makes it quite difficult to give custom colors and fonts to
    > individual widgets.
    > Tk dosn't have that problem.


    It's not a problem: that's the *whole* *point*. You shouldn't be messing
    about making everything silly colours: it just makes things harder for
    your users.

    Ben

    --
    It will be seen that the Erwhonians are a meek and long-suffering people,
    easily led by the nose, and quick to offer up common sense at the shrine of
    logic, when a philosopher convinces them that their institutions are not based
    on the strictest morality. [Samuel Butler, paraphrased]
     
    Ben Morrow, Aug 26, 2006
    #3
  4. Davy

    Dean Arnold Guest

    Ben Morrow wrote:
    > Quoth zentara <>:
    >> WxPerl is based on Perl/Gtk2.

    >
    > No it isn't. wxPerl is a Perl binding for the wxWidgets toolkit, which
    > is a cross-platform GUI. It can be built to use Gtk; it can also use
    > Motif or raw X11 under unix, and native gui widgets under Max OS X and
    > Win32.
    >
    > It's biggest disadvantage is that the Perl bindings are not very well
    > documented, and you end up having to translate from the C++ docs.
    >


    s/very well//;

    BTW: some of the bindings are in fact different than the C++ version.
    And for extra fun, you get to guess which ones!

    That said, you may have some success using wxGlade as a GUI builder,
    as long as you're not doing anything too complicated.

    However, IMNSHO, browser based is the way to go
    for any modern GUI. Yes, there are some limitations, but you might
    be surprised at what can be accomplished using (e.g.) Dojo
    (http://www.dojotoolkit.org/), Rico (http://www.openrico.org/rico/home.page),
    script.aculo.us (http://script.aculo.us/), etc. And if all you need is
    some simple forms, then simple HTML may be sufficient.

    Dean Arnold
    Presicient Corp.
     
    Dean Arnold, Aug 26, 2006
    #4
  5. Davy

    zentara Guest

    On Sat, 26 Aug 2006 17:37:03 +0100, Ben Morrow <>
    wrote:

    >Quoth zentara <>:
    >>
    >> WxPerl is based on Perl/Gtk2.

    >
    >No it isn't. wxPerl is a Perl binding for the wxWidgets toolkit, which
    >is a cross-platform GUI. It can be built to use Gtk; it can also use
    >Motif or raw X11 under unix, and native gui widgets under Max OS X and
    >Win32.


    Yeah but in reality, almost every linux distribution builds it on Gtk2.
    And when building it, it will default to Gtk2 if it's found.

    >> Now for the bad news. Perl/Gtk2 can make it very difficult to do
    >> what is simple in Tk. The most obvious thing is colorization of
    >> widgets. Gtk2 has a powerful "theme" system, so you can make all your
    >> apps look like your other Gtk2 apps like mozilla. BUT, that same theme
    >> system, makes it quite difficult to give custom colors and fonts to
    >> individual widgets.
    >> Tk dosn't have that problem.

    >
    >It's not a problem: that's the *whole* *point*. You shouldn't be messing
    >about making everything silly colours: it just makes things harder for
    >your users.


    Why does making a textbox with a black background, (which is easier on
    the eyes), make things hard for the user?

    I was chastised by other Perl/Gtk2 users for saying this, and their
    reason was that "themes" should never be tampered with..... like
    some mantra learned in CS classes.

    But I've written alot of little apps, and for appearance, and ease on
    the eyes, colorization is very useful.


    A few other comparisons bewtween Tk and Gtk2 (and WxWidgets built on
    Gtk2).

    1. Tk is very easy to install, and install cross-platform, thanks to
    ActiveState's inclusion of it in it's Perl for windows.
    Gtk2 on the other hand, can be a nightmare of interrelated packages,
    which must be installed in a particular order. Window's versions are
    finicky and difficult to get running.

    2. The Canvas, which in my opinion, is the best all around widget, is
    quite good on Tk. And has a big-brother named Zinc, which has many
    extra features like transparency, rotations and scaling.
    In Gtk2, the Canvas is "up in the air" and cannot be counted on to
    be stable into the future. Apparently their are competing replacements
    coming along, but no one knows where it will settle out. So Canvas
    use on Gtk2 based apps is an iffy proposition right now.


    Finally, don't get me wrong. I like and support Gtk2. But it is much
    harder to learn and use than Tk.
    I do find the thoughtful design,
    where all widgets all based on Glib's Gobjects, very satisfying, in the
    sense that it makes it apparent that there are brains behind the design.

    I think that in about 5-10 years, when Perl/Gtk2 has had time to work
    out better docs, and maybe have a book published on how to
    use it, it will be the best thing going.

    But for now, I reach for Tk first.


    --
    I'm not really a human, but I play one on earth.
    http://zentara.net/japh.html
     
    zentara, Aug 27, 2006
    #5
  6. Davy

    zentara Guest

    On Sun, 27 Aug 2006 13:02:13 GMT, zentara <>
    wrote:

    >On Sat, 26 Aug 2006 17:37:03 +0100, Ben Morrow <>
    >wrote:
    >
    >>Quoth zentara <>:
    >>>
    >>> WxPerl is based on Perl/Gtk2.

    ^^^^^^^^^^^^^^^^^^^^^^^^^
    >>
    >>No it isn't. wxPerl is a Perl binding for the wxWidgets toolkit, which
    >>is a cross-platform GUI. It can be built to use Gtk; it can also use
    >>Motif or raw X11 under unix, and native gui widgets under Max OS X and
    >>Win32.

    >
    >Yeah but in reality, almost every linux distribution builds it on Gtk2.
    >And when building it, it will default to Gtk2 if it's found.


    Sorry, I did make a mistake there.
    I just downloaded the latest WxWidgets and it does use X11 by default.
    The WxWidgets c libs did build Ok.

    But I still couldn't get wxPerl going.
    First Wx-0.56 said I needed Module::pluggable and Alien-wxWidgets
    Ok, 2 prerequites, no big deal, but when building
    Alien-wxWidgets I get errors:

    Manifying blib/lib/Alien/wxWidgets.pm -> blib/libdoc/Alien::wxWidgets.3
    'gl' library not found at inc/My/Build/Any_wx_config.pm line 141.
    'animate' library not found at inc/My/Build/Any_wx_config.pm line 141.
    'fl' library not found at inc/My/Build/Any_wx_config.pm line 141.
    'stc' library not found at inc/My/Build/Any_wx_config.pm line 141.
    'deprecated' library not found at inc/My/Build/Any_wx_config.pm line
    141.
    'gizmos' library not found at inc/My/Build/Any_wx_config.pm line 141.
    'ogl' library not found at inc/My/Build/Any_wx_config.pm line 141.
    'plot' library not found at inc/My/Build/Any_wx_config.pm line 141.
    'mmedia' library not found at inc/My/Build/Any_wx_config.pm line 141.
    'svg' library not found at inc/My/Build/Any_wx_config.pm line 141.

    #########################################################
    So I'm not going through all those problems, when Tk builds just
    fine with

    perl Makefile.PL
    make
    make install

    Sorry, I still say WxPerl is too much hassle, let alone there are no
    docs.

    I still maintain Tk still is easiest for a new gui programmer.
    Followed second by Perl/Gtk2 (which does build and install fine)


    --
    I'm not really a human, but I play one on earth.
    http://zentara.net/japh.html
     
    zentara, Aug 27, 2006
    #6
  7. Davy

    Justin C Guest

    On 2006-08-27, zentara <> wrote:
    > On Sat, 26 Aug 2006 17:37:03 +0100, Ben Morrow <>
    > wrote:
    >>
    >>It's not a problem: that's the *whole* *point*. You shouldn't be messing
    >>about making everything silly colours: it just makes things harder for
    >>your users.

    >
    > Why does making a textbox with a black background, (which is easier on
    > the eyes), make things hard for the user?
    >
    > I was chastised by other Perl/Gtk2 users for saying this, and their
    > reason was that "themes" should never be tampered with..... like
    > some mantra learned in CS classes.


    Because the user's theme may be set because of visual impairment or some
    other accessibility problem. It's none of anyone's business what or how
    any else themes their system, and no one should go around messing with
    that.

    Justin.

    --
    Justin C, by the sea.
     
    Justin C, Aug 27, 2006
    #7
  8. Davy

    zentara Guest

    On 27 Aug 2006 20:19:36 +0200, Michele Dondi <>
    wrote:

    >On Sun, 27 Aug 2006 13:02:13 GMT, zentara <>
    >wrote:
    >
    >>A few other comparisons bewtween Tk and Gtk2 (and WxWidgets built on
    >>Gtk2).

    >
    >On an OT basis and on behalf of a friend of mine[*]: he's been having
    >difficulties using threads with Tk. I don't have experience with
    >either so I couldn't really help him, but from posts both here and on
    >PM I already knew about the possible issues, so I just reminded him of
    >good ol' fork(). Now the question is: is Gtk2 thread safe? Which
    >toolkit is, if any?


    >Michele


    Well that is one of the good points about Gtk2 which I did not list.

    It does have a "thread-safety mechanism", which appeared releatively
    recently, around the 2.8 series of modules. Although it isn't perfect,
    it does show that the Gtk2 developers are aware of the problems and
    power of threads.


    What it does, is allow you to set ( see the thread_usage.pl in the
    examples subdir of the Perl/Gtk2 distro).

    use Gtk2 qw/-init -threads-init 1.050/;
    die "Glib::Object thread safetly failed"
    unless Glib::Object->set_threadsafe (TRUE);

    then in your threads, in the actual thread code block, you
    can do things like below, where you use enter and leave,
    to tell the main Gtk2 code that you are dipping into the thread and
    are going to modify a widget in the main thread.

    Gtk2::Gdk::Threads->enter;
    $progress->set_fraction ($i);
    $progress->set_text ($i * 100 .'%');
    Gtk2::Gdk::Threads->leave;
    # we're state employee's, so let's do some 'work'...
    sleep $sleep;


    This is a great advance, and similar code in Tk will result
    in the dreaded "free to wrong pool error" or a segfault.

    But as QoS pointed out, with proper precautions, threads can be
    successfully used with a main thread containing Tk code, but it is
    kind of a hack.

    So yes, Gtk2 is thread-safe (with some limitations). I've tested this
    quite a bit, and the Gtk2 thread-safety mechanism CAN be very finicky,
    but it's a start.



    --
    I'm not really a human, but I play one on earth.
    http://zentara.net/japh.html
     
    zentara, Aug 28, 2006
    #8
  9. Davy

    Joe Smith Guest

    zentara wrote:

    > Why does making a textbox with a black background, (which is easier on
    > the eyes), make things hard for the user?


    There are "high contrast" themes to make things easier on the
    eyes of those who need it. Selecting such a theme makes all
    textboxes "easier on the eyes", not just one or two.
    -Joe
     
    Joe Smith, Aug 29, 2006
    #9
  10. Davy

    zentara Guest

    On Tue, 29 Aug 2006 08:40:56 -0700, Joe Smith <> wrote:

    >zentara wrote:
    >
    >> Why does making a textbox with a black background, (which is easier on
    >> the eyes), make things hard for the user?

    >
    >There are "high contrast" themes to make things easier on the
    >eyes of those who need it. Selecting such a theme makes all
    >textboxes "easier on the eyes", not just one or two.
    > -Joe


    Yes, that is true; but what if you have a situation where you want to
    introduce a multiude of special colors.... for instance to show the
    results of complex regexes on the text? The high-contrast themes
    will often mask the desired colors. My point being, Tk has much more
    flexibility in this area than Gtk2, and it seems to me that the
    inability to easily adjust colors and fonts in individual widgets, gives
    the appearance of an incomplete toolbox.



    --
    I'm not really a human, but I play one on earth.
    http://zentara.net/japh.html
     
    zentara, Aug 30, 2006
    #10
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. paul.foreman

    GUI - GUI value passing

    paul.foreman, Oct 22, 2004, in forum: Java
    Replies:
    5
    Views:
    771
    Michael Rauscher
    Oct 25, 2004
  2. ulysses
    Replies:
    4
    Views:
    785
    Werner Schiendl
    Oct 22, 2003
  3. Andrew Lapidas

    PyGTK GUI update without signals from GUI

    Andrew Lapidas, Apr 13, 2008, in forum: Python
    Replies:
    0
    Views:
    423
    Andrew Lapidas
    Apr 13, 2008
  4. Stefan Ram
    Replies:
    3
    Views:
    505
    Arne Vajhøj
    Nov 20, 2011
  5. ngoc
    Replies:
    7
    Views:
    177
    zentara
    Jul 14, 2005
Loading...

Share This Page