Beefy Boxes and Bandwidth Generously Provided by pair Networks
No such thing as a small change

Which GUI do I choose?

by Snuggle (Friar)
on Dec 05, 2001 at 23:35 UTC ( #129721=perlquestion: print w/replies, xml ) Need Help??

Snuggle has asked for the wisdom of the Perl Monks concerning the following question:

Greetings fellow monks.....
I have written many perl scripts that run behind the scenes, but never one that had a GUI interface. I have been perusing CPAN and have been evaluating my options. What I am looking for is a GUI system that is somewhat portable, not too esoteric, and something that can do graphics with some degree of ease.

I have been looking at Tk for perl and that looks nice, and pretty easy. It covers that basic graphics requirement, but I am concerned about it portability. I have looked but can't really tell if the Tk perl package needs to be on the executing system (although I would assume it needed to be). Is Tk totally out of favor? Does anyone use it? Are there any other options that the monks have used that would fit my needs? Is there a gui system that can run on any perl installation, irrespective of the perl packages installed?

Anyway, no drug, not even alcohol, causes the fundamental ills of society. If we're looking for the source of our troubles, we shouldn't test people for drugs, we should test them for stupidity, ignorance, greed and love of power.

--P. J. O'Rourke

Replies are listed 'Best First'.
Re: Which GUI do I choose?
by Rhose (Priest) on Dec 05, 2001 at 23:47 UTC
    I have used Win32::GUI under 95/98/NT and Tk under 95/98/NT/Linux. Here is a good starting point for your question:

    (GUI) Windows Programming FAQ

Re: Which GUI do I choose?
by Starky (Chaplain) on Dec 06, 2001 at 00:50 UTC
    I must concur with the above response: I've used Tk as well and it works great on both *nix and Windows.

    Installing it is a breeze, learning it is easy, and the widget set is very nice and mature in terms of reliability and use. The canvas widget deals with graphics easily, though if you're looking to make a first-person-shooter it won't be sufficient. I typically just create the graphics with GD or something, then attach them to a canvas, though there are native functions for drawing directly on the canvas.

    While you do have to have the Tk module installed on any machine that will be running your scripts, you can also purchase PerlApp from ActiveState, which will allow you to turn your Perl scripts into binaries on Solaris, Linux, and Windows. I've used it before to build rather robust Perl/Tk applications, replete with complex compound widgets etc., and it works like a charm. The Windows users typically never realize they are running something written in Perl and the code gets written in half the time.

    Hope this helps :-)

(ichimunki) Re: Which GUI do I choose?
by ichimunki (Priest) on Dec 05, 2001 at 23:55 UTC
    Tk is the only GUI system for Perl that I know of that has its own book. To me that's a pretty strong recommendation as to its usefulness and level of favor. Installing it is also *very* easy on both Windows and Unix/Linux. I use Tk all the time and I'm pretty sure other monks do as well.
Re: Which GUI do I choose?
by sparkyichi (Deacon) on Dec 06, 2001 at 00:01 UTC
    In this Node I was talking about using perl2exe (I swear I am not a rep for the company.) If you write your code so that it is system independent, you can then compile your script for the Unix platform that you are planning on using so you will not need to worry about having the right modules in place. This meens that you have the freedom to move your code from box to box. The down side is that if you make any changes you will not only have to recompile your code, but you also need to worry about version control. I have not done much Unix GUI work but the man pages for Perl/Tk say that it is portable. Just keep in mind when making your programs that you what it to be able to run on a Unix and a Windows platform.

    I love Perl/Tk and I find that I can do just about every thing that I want to do (except bind F1 key...Stupid me.) Besides using the man pages I have the Mastering Perl/Tk from O'Reilly and I find it to be the best reference for working with Perl/Tk. I strongly recommend that you check this out if you are really interested.

Re: Which GUI do I choose?
by scott (Chaplain) on Dec 06, 2001 at 00:21 UTC

    There's also wxPerl which is a wrapper for wxWindows. I'm not sure how easy it is to do graphics, that depends on what you mean. But it's certainly portable. You should have no trouble running your script on Linux, Win, and MacOS.

Re: Which GUI do I choose?
by Rhandom (Curate) on Dec 05, 2001 at 23:52 UTC
    This doesn't answer your question, and I hope it doesn't start a Qt/GTK war, but has anybody been able to get the perl-qt packages from CPAN to work. I have been able to get perl-gtk to work. What about perl-kde? They don't seem to compile.

    my @a=qw(random brilliant braindead); print $a[rand(@a)];

Re: Which GUI do I choose?
by Aighearach on Dec 06, 2001 at 02:10 UTC
    I've had a lot of success writing Perl GUI apps with Tk that run on both *nix and win*, in one version. I've had nothing but headaches with wxWindows.

    The only portability problems I've had with Tk are things like pointer icon colors.
    Snazzy tagline here

Re: Which GUI do I choose?
by baku (Scribe) on Dec 06, 2001 at 02:37 UTC

    As far as "packaging" scripts to run without modules pre-installed....

    If you can assume that Perl is present, you can write a mini-program to look for modules, e.g.

    unless ( eval " use Tk; " ) { &do_install ('Tk'); } exec "my-real-program.plx"; # ... sub do_install ($) { my $pkg = shift; print "Installing $pkg module..."; if ($^O =~ /win/i) { `ppm install $pkg.PPD`; } else { chdir ('unix_pkg'); `tar -zxf $pkg.tar.gz`; chdir ($pkg); require "Makefile.PL"; `sudo gmake install`; } }

    The above code is both untested (ergo probably nonfunctional and nonportable) and ugly, but it's near enough to what I've used in a pinch before.

Re: Which GUI do I choose?
by Chmrr (Vicar) on Dec 06, 2001 at 03:13 UTC

    See Win32::GUI vs Tk and Perl GUI? for previous discussions of this.

    perl -pe '"I lo*`+$^X$\"$]!$/"=~m%(.*)%s;$_=$1;y^+*`^ ve^#$&V"+@( NO CARRIER'

Re: Which GUI do I choose?
by strat (Canon) on Dec 06, 2001 at 16:26 UTC
    I use Tk quite a lot, because of it's portability. Linux, Solaris and WinNT/2k/XP are great, but there are (or have been?) some minor problems under Win9x/ME, e.g. -underline didn't work, focus-Stuff, mouse recognition when changing Windows with Alt+Tab, resizing the main-Window, ...
    But my experiances with Win9x are back about 2 years, so maybe a lot might have changed...

    Best Regards,
    perl -e "print a|r,p|d=>b|p=>chr 3**2 .7=>t and t"

      I agree. My team and I have done a lot of work in Perl/Tk. It is very flexible and supremely portable. Problems are minor and easily solved.

      Regards, Helgi Briem

Re: Which GUI do I choose?
by TomK32 (Monk) on Dec 06, 2001 at 03:00 UTC
    Why don't you simply differ between the script which does all the work and the GUI which executes the script?
    So everyone could write his own GUI for which platform he wants to and even the console guys will be happy :)
    package Lizard::King; sub can { do { 'anything'} };
Re: Which GUI do I choose?
by drifter (Scribe) on Dec 06, 2001 at 05:18 UTC
    I've been using perl/TK, although I like tcl/tk too, I still think Perl/TK is a bit easier to write, although it's not perhaps as portable, but I like it. I used that for a benchmarking program where you chose the options from the GUI and then start the main program, although it could have been done with command-line options, I felt that I had too many options and chose another approach to that current problem. In any case I would encourage the use of perlTK.
Re: Which GUI do I choose?
by kevin_i_orourke (Friar) on Dec 06, 2001 at 17:38 UTC

    Tk comes with ActiveState Perl for Windows, so lots of people already have the Tk module installed.

    My personal experience is that Tk's widgets make life much easier by already providing much of the functionality you could want. The Canvas is especially good, you can draw graphics and text, have objects in the Canvas respond to events (mouse-clicks, etc.) and it will output to PostScript.

    Kevin O'Rourke

      Yes, especially the canvas is great. I played around a little bit and had written an easy game within some hours. If you want, you can download it from -> Tips&Tricks -> Eigene Scripte -> Download von Käsekästchen

      It's not yet finished (maybe will never finish), but writing it was big fun.

      Have fun,
      perl -e "print a|r,p|d=>b|p=>chr 3**2 .7=>t and t"

Log In?

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://129721]
Approved by root
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others examining the Monastery: (2)
As of 2019-08-24 09:01 GMT
Find Nodes?
    Voting Booth?

    No recent polls found