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

Hello All,

I would like to segway into the wonderful world of GUIs. Earlier today, I poked around the Monestary looking for information on Win32::GUI. After a few failed attempts at running simple tests, I decided to look up Tk. (See also: Win32::GUI vs Tk)

The Tk module comes with ActivePerl, and the test I found on PerlMonks: Re: Tk on Win32 worked perfectly.

The mental wheels started turning...

Many useful applications never take off until they have a friendly, usable interface. Tk will be able to provide a pretty frontend to my Perl scripts. And, from what I understand (I may be mistaken) Perl/Tk will run on any machine with Perl and the Tk module.

I would like to know if any one has some good references for programming with Tk. I have found, however, that much of the information on Tk deals with Tcl as well. I am completely unfamiliar with Tcl, with the exception that it's fairly easy to include in other languages. The two PM articles listed above were all I could find that dealt with Tk.

Given: Perl/Tk. I haven't gotten a chance to get to the bookstore yet, but next time I do, it will be purchased :)

Initially, I would like to create some simple apps that display various plain-text files, a log viewer, so to speak, so any information dealing with presenting text in a window would be greatly appreciated.

So, the short of the long is: if anyone has any good online references for a newbie to Tk, would you mind passing them along?

Many thanks,
John J Reiser
newrisedesigns.com

  • Comment on Using Tk for display/information purposes

Replies are listed 'Best First'.
Re: Using Tk for display/information purposes
by jlongino (Parson) on May 17, 2002 at 04:13 UTC
    I haven't done much with Perl/Tk though I have bought and reviewed Mastering Perl/Tk. There seems to be a concensus from most people I've talked with that you should skip the earlier O'Reilly book Learning Perl/Tk. lemming replied in my review thread and gave a link to online program examples from the book. dreadpiratepeter also did a review.

    If you haven't already, you might also want to check out the Demos that came with Tk.pm located in something like  C:\Perl\site\lib\Tk\demos if you are using ActiveState Perl (and used the standard install directories).

    --Jim

Re: Using Tk for display/information purposes
by {NULE} (Hermit) on May 17, 2002 at 13:55 UTC
    Hi,

    I'm a big fan of Tk so I may be biased when I compliment you on your choice of Perl GUI APIs. :) Seriously it runs just about everywhere, and is pretty hassle-free compared to getting Gtk or wx to work on the platforms where they are supported. Some don't like the looks of Tk, but except for a few detail items that Tk isn't able to control, I think it looks presentable.

    As for learning, I'd have to agree that all I've heard about Mastering Perl/Tk is a positive. If you want to give it a good go on your own you can do what I did - find examples at the monastery and ones that come with Tk. Keep a web browser open to the ActiveState documentation on Tk. Then just go to town. Start with simple examples and in no time ideas for useful applications will start to come to you.

    If you are entirely new to GUI program one of the biggest hurdles you will have to cross is probably getting used to event driven programming. There are discussions around the monastery about how to adapt to the event-driven way of programming like this one of mine. Oh, I see I also talk about it here and both of those nodes have nice, simple (and hopefully programmatically "correct") examples of Perl/Tk code.

    Good luck to you, and hopefully you will enjoy entering the world of GUI programming. I think Perl/Tk is a good way for you to go.
    {NULE}
    --
    http://www.nule.org