Beefy Boxes and Bandwidth Generously Provided by pair Networks
P is for Practical
 
PerlMonks  

Re: Is there a better way to learn Tk?

by zentara (Archbishop)
on May 08, 2009 at 10:44 UTC ( [id://762799]=note: print w/replies, xml ) Need Help??


in reply to Is there a better way to learn Tk?

"is there a better way?"

Yes, Perl/Gtk2. Gtk2 has a pretty good object inheritance( who am I to judge OO style :-) ). Everything descends from a GLib object, and Glib itself is not dependent on X.

The problem with Gtk2 is that the docs are auto-generated......that way they can keep the current libs and docs up-to-date, just by running a program that autogenerates everything (which is then checked for bugs by everyone). This makes the docs very terse, but there is an inheritance tree included in all the docs....and just as its supposed to work..... each descendant inherits the stuff from the ancestor. Yeah !! It actually works!!

Tk, on the other hand, is a collection of independent widgets (that have been glued together remarkably well by the TCL/Tk libs). The perl port adds another abstract layer ontop of the TCL/Tk, where signals/etc can get lost. I sort of look at Perl/Tk now, as the "Windows95" of guis. Very cool and easy to make simple guis.....but way behind the times.

Nick Ing Simmons was the Master behind Tk, and he got sick and died a few years ago, may he RIP. Since then, only sporadic attention has been paid to Tk, by a few C/Perl gurus. So Perl/Tk is probably headed for the history bin. If you really like the Tk style( as opposed to Gtk2 or Wx), of programming.....switch to TCL/TK. I hear it is pretty up-to-date, but it isn't Perl. ( There is a monk around here called Vorkon ??.... who promotes a Perl module for Tcl?Tk.

I would only write Perl/Tk now if it was an extremely simple quick app, or it was patching some old code.

The best way to learn either Tk or Gtk2, is to use groups.google.com to search for examples of the widgets you want to use. I find jumping right into examples, is faster than reading a book. If you do resort to a book....get an online version or cd version, so you can cut-n-paste code snippets, and run the examples. 50% of it all, is just learning how to avoid the common runtime mistakes, like declaring modules properly, getting commas and fat arrows correct, etc. The more test programs you run, the more error messages you will see ( :-) ) , and then you learn to quickly fix problems.

I found some really weird Tk syntax errors, that can be totally perplexing......where you get an error like "not valid at mainloop line 67"...... and the error would be caused by some syntax error in pack, where you do something like make an => a = and the Tk part of the program dosn't throw an error.

P.S. Howdy. .. to my Finish cousin :-)


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

Replies are listed 'Best First'.
Re^2: Is there a better way to learn Tk?
by Anonymous Monk on May 08, 2009 at 10:51 UTC
    I sort of look at Perl/Tk now, as the "Windows95" of guis.
    More like Windows3.1 with unbelivably long lifetime

Log In?
Username:
Password:

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

How do I use this?Last hourOther CB clients
Other Users?
Others romping around the Monastery: (7)
As of 2024-03-19 02:49 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found