Beefy Boxes and Bandwidth Generously Provided by pair Networks
Perl Monk, Perl Meditation

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 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

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

  • Posts are HTML formatted. Put <p> </p> tags around your paragraphs. Put <code> </code> tags around your code and data!
  • Titles consisting of a single word are discouraged, and in most cases are disallowed outright.
  • Read Where should I post X? if you're not absolutely sure you're posting in the right place.
  • Please read these before you post! —
  • Posts may use any of the Perl Monks Approved HTML tags:
    a, abbr, b, big, blockquote, br, caption, center, col, colgroup, dd, del, div, dl, dt, em, font, h1, h2, h3, h4, h5, h6, hr, i, ins, li, ol, p, pre, readmore, small, span, spoiler, strike, strong, sub, sup, table, tbody, td, tfoot, th, thead, tr, tt, u, ul, wbr
  • You may need to use entities for some characters, as follows. (Exception: Within code tags, you can put the characters literally.)
            For:     Use:
    & &amp;
    < &lt;
    > &gt;
    [ &#91;
    ] &#93;
  • Link using PerlMonks shortcuts! What shortcuts can I use for linking?
  • See Writeup Formatting Tips and other pages linked from there for more info.
  • Log In?

    What's my password?
    Create A New User
    and all is quiet...

    How do I use this? | Other CB clients
    Other Users?
    Others contemplating the Monastery: (8)
    As of 2018-06-20 10:05 GMT
    Find Nodes?
      Voting Booth?
      Should cpanminus be part of the standard Perl release?

      Results (116 votes). Check out past polls.