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

in praise of poor old Tk

by zentara (Archbishop)
on Feb 18, 2014 at 11:05 UTC ( [id://1075318]=perlmeditation: print w/replies, xml ) Need Help??

You know, when I first started programming, about 20 years ago, I thought Perl/Tk was the ticket. Finally something which allowed you to make your own GUI's without having to resort to buying Microsoft software. It worked great, and still works great.

In the meantime, other GUI toolkits, such as the short-lived Gtk, Gtk2, and currently Gtk3, and others such as Wx and KDE have come along. But they are always changing so fast, to incorporate such great new features as semi-transparencies, gradients, and whatever new themeing engines they might want compatibility with.

So, I look back at Tk, knowing that for the most part, all my scripts still run pretty much as I wrote them way back when. It is simple, and stable. My newer Gtk2 scripts, may not convert without some work, to Gtk3. Additionally, the docs for Gtk3, Wx and ( KDE ) Qt GUI's are hard to come by.

But just look at the Tk code base. It needs no pre-requisite libs to be installed, and is a very small module compared to the GUI potential, which it contains. In days of heightened security over code safety, Tk is an easy to module to deal with. Additionally, if you do need transparency and all the matrix operations like rotations, the Tk::Zinc module works great. It is now somewhat abandoned code, but the module still works, and it used to be used as the air-traffic display driver for some French airports. So you know it isn't junk software. It comes with a nice pdf manual, documenting all it's features.

It is kind of funny to me, that the entire drive to make more advanced toolkits, was so that the themeing engine of the host computer would decide how the window app would look. Many like the simplicity of Tk's ability to individually set each widget's colors and fonts with a few simple lines, like -bg=>'#112233', instead of needing a special style section to overide the system's style settings.

Anyways, I still reach for Tk whenever I need a GUI app. It is suitable for almost all small custom tasks. I would even trust it for digital guages and controls.

... and it's way easier to write code for, than any other toolkit out there

I'll bet Perl/Tk will still be around after Gtk5 and Wx99 are come and gone. :-)


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

Replies are listed 'Best First'.
Re: in praise of poor old Tk
by Discipulus (Canon) on Feb 18, 2014 at 12:05 UTC
    This post is something i was looking for a while. The state of the art of GUI programming with Perl was a problem that come to my mind many times in these years.
    When i have to choose a Perl tool to do something complex or maintainable over years everytime i have a dread: will these libs maintained over time? or i' ll find myself to be forced to migrate to another lib in x years? Dread becomes greater as x becomes smaller...
    Whilst i feel comfortable with my choose of DBI or CGI this was not the situation respect GUI programming: Gtk and Wx were appetissable for shiny new effects.. but at which cost?

    So, me too, i choosed poor old Tk as object of study because stability is a must.
    So zentara, i join your praise for old poor Tk and, if i can add, i pray for a new vigor to Tk::Zink too.

    L*
    There are no rules, there are no thumbs..
    Reinvent the wheel, then learn The Wheel; may be one day you reinvent one of THE WHEELS.
Re: in praise of poor old Tk
by Tux (Canon) on Feb 18, 2014 at 12:35 UTC

    Hear, hear! zentara++. I FULLY share this opinion.

    The fact that p/Tk has almost no prereqs makes it easy to build out of the box on platforms that are a nightmare to build e.g. Wx on, like AIX and HP-UX.

    For me it is p/Tk all the way for ages.

    As a side note: people that complained to me that Tk looked ugly quite often said they'd port my tool/app to Wx or whatever, but I have never seen any result. And when one disables decoration, p/Tk apps just look like any other app :)


    Enjoy, Have FUN! H.Merijn
Re: in praise of poor old Tk
by syphilis (Archbishop) on Feb 18, 2014 at 11:31 UTC
    and currently Gtk3 ...

    ... which is inaccessible to perl on Windows, afaik.

    The perl Gtk3 module has a dependency upon the Glib::Object::Introspection module which, in turn needs the gobject-introspection library.
    Last time I checked, I couldn't find any Windows binaries for gobject-introspection and trying to build the library myself is the most frustrating experience I have *ever* had as regards building a single library - due mainly to the involvement (and inadequacy) of python in the build process.

    I'd be interested to hear if anyone has better success than I had when trying to install Glib::Object::Introspection on Windows.
    Or maybe someone knows of gobject-introspection binaries for Windows ? (I've given up on even checking.)

    Cheers,
    Rob
Re: in praise of poor old Tk
by sam_bakki (Pilgrim) on Feb 19, 2014 at 08:07 UTC

    Hi

    I am still Big FAN of GTK2 + Glade + Perl for my GUI Projects. Its may be because I started GUI development in perl just 3 years ago.

    I should really thank syphilis for providing Perl GTK2 windows PPM packages in http://www.sisyphusion.tk/ (compatible with Active perl and very easy to install).

    Thanks a lot syphilis without your PPM repository, I could have not learnt Gtk2 + Perl GUI development.

    Thanks & Regards,
    Bakkiaraj M
    My Perl Gtk2 technology demo project - http://code.google.com/p/saaral-soft-search-spider/ , contributions are welcome.

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlmeditation [id://1075318]
Approved by Corion
Front-paged by davido
help
Chatterbox?
and the web crawler heard nothing...

How do I use this?Last hourOther CB clients
Other Users?
Others having an uproarious good time at the Monastery: (6)
As of 2024-03-28 12:39 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    No recent polls found