|Syntactic Confectionery Delight|
"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