Solarplight has asked for the wisdom of the Perl Monks concerning the following question:

I know this is something of opinion, and I'm not trying to start a 'which ones better' war, but I am trying to decide on which toolkit to use. I've been screwin around with perl scripts on and off now for a little while, and want to go graphical. I'm talkin simple gui's. On a google search I found that there's a Tk module, thought about that because of my familiarity with Tkinter in python. After some searches here though tk seems to be about the only toolkit perl monks are not discussing. So really I'm just wondering what experienced users see as the main advantages and dis-advantages of the main toolkits, wxPerl, Qt, Gtk, Tk or any others I might not now about. I'm looking just for helpful information so I can make an educated decision. Don't need any 'this is the best' especially without reasons why you feel this. Sorry, I don't love startin these types of threads either. But, while it's easy to find lots of info on this stuff, it's hard to filter out whats legit. I'm really just tryin to get some info on these libraries from current users, and I figure PerlMonks is the place to go to talk to current perl users that know alot more than I.

Replies are listed 'Best First'.
Re: GUI Toolkit
by biohisham (Priest) on Jun 29, 2010 at 07:27 UTC
    Tk is a very robust module that has excellent documentation available and many properly designed widgets and additions. Its functions are named in an intuitive manner and there are many books written around it like Learning Perl Tk, Mastering Perl Tk and others.

    I think that this module having been around long enough and that Tcl/Tk programming is so mature serves as a plus point, on the flip side, the look and feel of the widgets are aging when compared to the other GUI modules out there. Nevertheless the module is quite stable and aptly documented and supported.

    Check GUI Programming-->What ISN'T good about PerlGTK? for a relevant discussion.

    Excellence is an Endeavor of Persistence. A Year-Old Monk :D .
      I second that!

      And besides, it seems to be the only GUI framework that never gave me any problem in installing or running under the various forms of Perl I used (ActiveState or Strawberry; from 5.6 all the way to 5.12).


      A program should be light and agile, its subroutines connected like a string of pearls. The spirit and intent of the program should be retained throughout. There should be neither too little or too much, neither needless loops nor useless variables, neither lack of structure nor overwhelming rigidity." - The Tao of Programming, 4.1 - Geoffrey James

      A plus from me too. Besides the fact that Tk is seen by many as ugly, I see very little shortcomings.

      Tk is actively maintained and builds on most OS's out of the box, including HP-UX, AIX, and Windows with Strawberry perl.

      The documentation is complete, and almost all fuctionality is available. It is very hard to make thing like rotated text on a Canvas, but if that is what you need, you might find some more luck in using Tk::RotCanvas or Tk::Zinc.

      After installing Tk, there is a demonstration script called widget, from which you can cut-and-paste code to get started.

      I found it very very hard to create a working anvironment on AIX and/or HP-UX to get Wx running, and I also dislike the immensely complicated (but complete) documentation for Wx. It just takes too much time and coding to get started, and if GUI programming is not a daily job, it is hard to remember all the ins and outs for Wx.

      Relatively new is Tkx, which looks very promising. As I already am very comfortable with Tk, I didn't really look into it yet.

      Playing directly with X11 modules is only for the masochists.

      Glib plus Gtk2 might be an option if you are on linux.

      Enjoy, Have FUN! H.Merijn
Re: GUI Toolkit
by kejohm (Hermit) on Jun 29, 2010 at 02:03 UTC

    There is a short discussion of GUI toolkits for Perl in perlfaq3.

    Since I mostly use Windows and don't really need the portability, I prefer to use the Win32::GUI module.

    Update: Link fixed.

      Thank you for the link, already read it good info though. I'm just interested in getting some input from people using them. Just some extra information ontop of the bundles.

        Win32::GUI is an excellent module for GUI programming on Windows, if you don't mind that it isn't cross platform. It provides most widgets available on Windows as part of the core module; there are a few separate packages available for other controls, such as a Scintilla control. It has a fairly simple interface, and a Visual Basic style event model.

        The documentation is mostly complete, and comes with a few simple tutorials. Access to Windows API documentation may be required if you need to perform more advanced operations. The module is based on SourceForge and has a mailing list in case you need help.

        I found another thread here with some more info about Perl GUI programming. It also has a list of some GUI builders for some of the toolkits.

        Update: Link fixed.

Re: GUI Toolkit
by ruoso (Curate) on Jun 29, 2010 at 12:11 UTC

    I have used Gtk2 for a while and, while I don't argue it is better or not than Tk or Wx, its integration with Perl certainly makes it worth on point of any disadvantage in front of its competitors. It's so tightly integrated that you can create a model class for some component in Perl and use an instance of that class in a widget that is not aware of Perl at all.

    That sums up with Pango (for unicode support), the fact that it is the standard GUI library for the majority of Linux machines and the fact that it is cross-platform as well.


      The other thing I like about Gtk2 is how well it integrates into Gnome. Not to mention being the native toolkit for things like Debian and Ubuntu and most Linux distros.

Re: GUI Toolkit
by Anonymous Monk on Jun 30, 2010 at 15:33 UTC

    My advice is to go with GTK. Some reasons (in no particular order) are:

    • it's simple enough (though probably not as simple as Tk)
    • it's written in C (wx and Qt are C++, Tk is Tcl I believe)
    • it's cross-platform (though not sure how the new Mac OS X Quartz port is coming along -- you may still have to use X11 on OS X for a while yet if you want to run on OS X)
    • it's the standard toolkit for Gnome (as Qt is for KDE and also for future Nokia MeeGo-based smartphones)
    • lots of apps use it
    • it seems to be the most popular choice among Perlers (though, maybe neck-and-neck with Tk), so you should be able to get enough help from the community if necessary
    • the Perl bindings look pretty well-maintained
    • GTK GUI's look nice enough (I'm not a proponent of trying to make your GUI look native on every platform)
    • good licensing (LGPL)