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

Can anyone explain this to me? So far all I've been able to grasp is that it has something to do with graphics.

Replies are listed 'Best First'.
Re: Tk....What exactly IS it?
by tachyon (Chancellor) on Sep 02, 2004 at 00:09 UTC

    Tk the Perl module is an interface written by Nick Ing-Simmons to Tcl/Tk. Tcl/Tk is actually two products originally developed at the University of California Berkeley, now at Sun by John Ousterhout: the Tool Command Language and the Tool Kit. They are a versatile scripting language and a graphical interface development tool, respectively.

    In brief Tk lets you build GUIs. If you build a Tk GUI with Perl it should run on just about anything Perl (and Perl Tk) runs on. By way of simple example it will almost certainly run on Win32 or Linux.



      So is Tk useful for anything (I know it's useful for some things), or just that? And would it be worth it to spend money for a book on?

        PEBKAC. Tk does GUI widget stuff as noted above. If you need to do GUI widget stuff Tk is useful. Tcl (Tool control language) is a scripting language like Perl and is not Tk. Tcl can do lots of different stuff like Perl, but Tk just does widgets. The history of Tcl and Tk



        I picked up the O'Reilly book "Learning Perl/Tk" out of a book bin at a local book store. It cost me all of $7.00. While I haven't actually used a GUI on any of my Perl projects, I've enjoyed going through the book and learning about Perl/Tk. I usually pull it out when I'm feeling like I need a change in perspective. It's just different enough from what I'm usually working on that it provides me with some amusement.

        While I wouldn't recommend spending big bucks on a book about a technique you may never need, if you can pick up something inexpensive, it's worth the investment. For myself, if in the future I find I need a GUI for something, I'll be partly prepared to tackle that.

Re: Tk....What exactly IS it?
by Aristotle (Chancellor) on Sep 02, 2004 at 00:05 UTC

    It's a class library implementing a widget toolkit.

    Makeshifts last the longest.

Re: Tk....What exactly IS it?
by zentara (Archbishop) on Sep 02, 2004 at 13:05 UTC
    Besides what others have said about GUI creation, Tk is a different kind of programming, involving an "event loop". You need to think abit differently when programming in event loops. But after you get used to it, there is alot more you can do, like setup background timers, multi-tasking, etc.

    POE is another example of "event loop" programming, and you can even use Tk to run event loops without the GUI, by withdrawing the mainwindow.

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