Beefy Boxes and Bandwidth Generously Provided by pair Networks
Think about Loose Coupling
 
PerlMonks  

Should I use Perl/TK?

by TechFly (Scribe)
on May 09, 2012 at 20:38 UTC ( [id://969700]=perlquestion: print w/replies, xml ) Need Help??

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

I am contemplating playing around with windows programs and perl. I have been using perl scripts for many things at work on my linux boxes, and wanted to try writing some things for the windows boxes too. Specifically I want to play with GUI programming. Is Perl/TK the way way to go about this, or are there other better options? I read that Perl/TK is outdated, and should not be used anymore, and to use tkx. Any advice?

Is one easier than the other? Is one faster, better, and so on. I know, these can be loaded questions, but I don't really know where to start. I found several how-to's, but they seem to be very out of date. CPAN has a link to a toutorial on the perl tk page, but it was from 1999. Is it still what I should be working with?

Replies are listed 'Best First'.
Re: Should I use Perl/TK?
by zentara (Archbishop) on May 10, 2012 at 10:54 UTC
    Is Perl/TK the way way to go about this....Perl/TK is outdated....use tkx?.... where are the tutorials?

    GUI toolkits come and GUI toolkits go, but Tk is still standing strong because of it's ease, wide user base to help answer questions, and documentation. The documentation available for Tk is better than for any other toolkit out there. Try Tk Tutorial and uwinnipeg Tk tutorial, and if you really want to become expert, see the Tk bible at Mastering Perl/Tk. You will not find better documentation for any other GUI toolkit.

    There are other GUI toolkits out there, namely gtk2-perl and WxPerl. They are state of the art, and evolving so fast it's hard to keep track. Needless to say, they are harder to use and understand the code.

    Finally, the Tk userbase is so big and experienced, that you will have little trouble getting help with problems as you learn.

    So yes, use Tk;. At the very least, it will help you quickly learn and get a GUI up and running. Then, if you want to move to the more advanced toolkits, you will already have a headstart on what is going on with things like the eventloop and packing. I pretty much can guarantee that once you learn Tk, you will find yourself using it, even if you know the other GUI toolkits, because of it's simplicity and ease of use.


    I'm not really a human, but I play one on earth.
    Old Perl Programmer Haiku ................... flash japh

      One more tutorial...

      I'll just add that since you're talking about different OS platforms (and wouldn't mind seeing different programming languages), the TkDocs - Tk Tutorial (which is not the same as zentara's Tk Tutorial) is fantastic.

Re: Should I use Perl/TK?
by graff (Chancellor) on May 10, 2012 at 02:28 UTC
    Perl/Tk is still actively supported, it works, and it might have the shortest learning curve for getting to a point where you can actually have a usable and useful program. Age is not an issue. The Tk library is also supported in other scripting languages besides Perl, so learning to set up a GUI with Tk is a portable skill.

    It offers sensible default behaviors so that you can get a decent-enough GUI working without sweating over lots of look-and-feel details, but the default result has an admittedly primitive appearance. The documentation (particularly in the Perl man pages) is amazingly detailed, so when you want to figure out how to tweak things, the information is there (at least, enough so that you can do effective experiments pretty quickly).

    There are things it can't really do at all, like bi-directional text (or actually any right-to-left text at all -- I think Arabic is still not possible with Tk), and things that other GUI libraries do much better (there are perl wrapper modules for Gtk and Qt), but Tk's Unicode support is good for all the left-to-right languages, and when you do a standard cpan install of Tk, the test suite that it runs through is impressive. The demo script is pretty awesome too -- very effective for learning how to put code together for various kinds of interfaces.

Re: Should I use Perl/TK?
by BillKSmith (Monsignor) on May 10, 2012 at 02:18 UTC

    I have been very pleased with perl/Tk for the few GUI projects which I have atempted. I never felt the need to try anything else. The book "Mastering perl/Tk" has been very helpful.

Re: Should I use Perl/TK?
by Anonymous Monk on May 09, 2012 at 20:47 UTC
Re: Should I use Perl/TK?
by TechFly (Scribe) on May 10, 2012 at 13:19 UTC

    Thanks guys for the answers. That is exactly what I was looking for. This is why I love the perl community so much!

Re: Should I use Perl/TK?
by bulk88 (Priest) on May 10, 2012 at 16:35 UTC
    I would not use PerlTK. The author IRL died a few years ago I heard. PerlTK is a fork of the Tk graphics/gui library, with the Tcl interp replaced with a layer around the Perl interp so the Perl Interp has the same C API as the Tcl Interp and the Tk C graphics library thinks its interacting with a Tcl Interp when its Perl Interp in sheeps clothing. The Perl language side of PerlTk is written ontop of the C API of Tk. Tkx and Tcl::Tk are written ontop of the Tcl API of Tk. Perl TK is a very adventurous design but difficult to maintain. It has not been code synced with mainstream Tk since the 1990s I think. PerlTK will not be getting any upgrades or features ever again due to its design. Bug fixes are hard to get and it will never reach a "1.0" version. Perl Tk is Perl's oldest, most native, and close to heart of Perl dev's, GUI system. Its even had half a dozen paper books written on it, Tkx/Tcl::Tk none. Use Tcl:Tk or Tkx. They are blind/automated bridges to the Tcl interpreter (think about Win32::OLE), whichever Tcl interp is installed on your machine. Any new features that Tk gets instantly appear in Tkx/Tcl::Tk. Bugs are always Tk's devel's problems, not perl's or cpan devel's problems. Also Perl Tk isn't thread safe and never will be. Tkx/Tcl:Tk are because the Tcl Interp is thread safe. Using Perl Tk's C API to submit events from random OS threads to the Perl Tk event loop using Tk's C API is a race condition that works because 99% of the time because Perl interp is asleep in the event loop.

      HUMBUG! perl/Tk is actively maintained and has the huge advantage over other GUI toolkits that it has close to no dependencies, making it easy to get it work on almost any OS. The only disadvantage is that some perceive the decoration as old-fashioned. So be it.

      commit c5696bfa93d2aacef2a47e05593cc6ebe6e5bf64 Author: Slaven Rezic <slaven@rezic.de> Date: Mon Nov 7 22:06:23 2011 +0100 * workaround PAUSE permission problems with Tie::Watch::* commit 89d97687ca8463a9ceb9e5400fb9c9d0cbd6cf3f Author: Slaven Rezic <slaven@rezic.de> Date: Fri Oct 21 23:24:14 2011 +0200 * README-Strawberry and 804.030 commit daeb23466a94856ae29db58ece6e95b75e246a55 Author: Slaven Rezic <slaven@rezic.de> Date: Fri Oct 21 19:33:48 2011 +0200 * do VERSION munging correctly, without eval commit 060a84262dbbf29aebadaf20ff4eedff3c2ce4a7 Author: Slaven Rezic <slaven@rezic.de> Date: Fri Oct 21 19:34:32 2011 +0200 * 804.030 commit c4dd9f915faf178ac7bc162f037baf2998317811 Author: Slaven Rezic <slaven@rezic.de> Date: Mon Oct 17 23:04:33 2011 +0200 * inc'd VERSION to 804.029_502

      Enjoy, Have FUN! H.Merijn
        HUMBUG! perl/Tk is actively maintained and has the huge advantage over other GUI toolkits that it has close to no dependencies, making it easy to get it work on almost any OS.
        perl/tk is not a binding to Tk, it is a port of Tk source to perl. Nick I-S had partially automated this to keep up with updates, but Tk 8.5 is not an update. The file names are changed with the whole ttk tree added. It would be a new port from scratch.

        http://groups.google.com/group/comp.lang.perl.tk/browse_thread/thread/5b46aee9cb6bbe12/cf296a5a9bc5d713

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://969700]
Approved by ww
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others chanting in the Monastery: (3)
As of 2024-03-29 02:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found