Beefy Boxes and Bandwidth Generously Provided by pair Networks
Keep It Simple, Stupid
 
PerlMonks  

comment on

( #3333=superdoc: print w/replies, xml ) Need Help??
"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

In reply to Re: Is there a better way to learn Tk? by zentara
in thread Is there a better way to learn Tk? by ELISHEVA

Title:
Use:  <p> text here (a paragraph) </p>
and:  <code> code here </code>
to format your post; it's "PerlMonks-approved HTML":



  • Are you posting in the right place? Check out Where do I post X? to know for sure.
  • Posts may use any of the Perl Monks Approved HTML tags. Currently these include the following:
    <code> <a> <b> <big> <blockquote> <br /> <dd> <dl> <dt> <em> <font> <h1> <h2> <h3> <h4> <h5> <h6> <hr /> <i> <li> <nbsp> <ol> <p> <small> <strike> <strong> <sub> <sup> <table> <td> <th> <tr> <tt> <u> <ul>
  • Snippets of code should be wrapped in <code> tags not <pre> tags. In fact, <pre> tags should generally be avoided. If they must be used, extreme care should be taken to ensure that their contents do not have long lines (<70 chars), in order to prevent horizontal scrolling (and possible janitor intervention).
  • Want more info? How to link or or How to display code and escape characters are good places to start.
Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others studying the Monastery: (2)
As of 2021-12-05 09:22 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    R or B?



    Results (31 votes). Check out past polls.

    Notices?