Beefy Boxes and Bandwidth Generously Provided by pair Networks
Syntactic Confectionery Delight
 
PerlMonks  

Most portable way of GUI programming?

by professa (Beadle)
on Dec 01, 2002 at 22:04 UTC ( #216811=perlquestion: print w/replies, xml ) Need Help??

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

Hi!

I'm not familiar at all in GUI-programming with Perl but I can see this coming in the next few months and I wonder what's the most portable way of doing this?
That GUI would need to have buttons, lists, maybe checkboxes, and areas where custom graphics (some kind of collapsable trees) could be drawn. Oh, and a window of course... ;-)

Which GUI (and module ;-) is the way to go for in terms of portability mainly under all kinds of Unix (portability to Win32 would be nice, but is not really needed)?

Thanx in advance, Micha

Replies are listed 'Best First'.
Re: Most portable way of GUI programming?
by dpuu (Chaplain) on Dec 01, 2002 at 23:16 UTC
    The most portable solution is to minimze the GUI code. Think of the user interface as a set of interacting state machines: and code them as such. Implement tests of this control layer as simple (or not so simple) sequential scripts.

    Once the control logic is properly encapsulated, the addition of the actual GUI interface is not a major issue: you can try a number of different ones. I generally recommend against the "common-denominator" approach, because it leads to GUIs that look equally bad on all platforms. --Dave.

Re: Most portable way of GUI programming?
by belg4mit (Prior) on Dec 01, 2002 at 22:29 UTC
    Other directly manipulating X widgets, most GUI toolkits available to perl are cross-platform. These include Tk, Qtk, and Wx. I've only tried Tk myself, but would be prone to try Wx.

    --
    I'm not belgian but I play one on TV.

Re: Most portable way of GUI programming?
by dree (Monsignor) on Dec 02, 2002 at 00:34 UTC
    As said here, there are at least 3 multiplatform GUIs: Perl/Tk, wxPerl, Prima.

    wxPerl looks like the windows manager of the O.S., the others have their own look & feel.
    Perl/Tk is a mature product, well documented (it has a book and a newsgroup), wxPerl is young but it's growing up (it is strongly OO), and Prima is focused on 2D image processing
Re: Portable GUI Programming
by cjf-II (Monk) on Dec 02, 2002 at 04:34 UTC
Re: Most portable way of GUI programming?
by logan (Curate) on Dec 02, 2002 at 05:26 UTC
    Why not make it a cgi? TK and Win32::GUI are great, don't get me wrong, but a cgi will allow you to make the code truly cross-platform. You can do buttons, lists, checkboxes, whatever you need, and you won't have to worry about a rewrite if you have to port it to another OS. Plus, you don't need to install any CPAN modules to put it on a new machine, as I recall, CGI.pm comes standard.

    -Logan
    "What do I want? I'm an American. I want more."

      ...areas where custom graphics (some kind of collapsable trees) could be drawn.

      A CGI really doesn't solves this problem, does it?

      And maybe you don't need to install CPAN modules, but you might have to install a webserver.
        You have a point, but it's fairly easy to write a server in Perl.
        Popfile is a good example. Personally, when it makes sense for the application (No canvases, etc), I prefer the CGI approach.

        -Lee

        "To be civilized is to deny one's nature."
Re: Most portable way of GUI programming?
by helgi (Hermit) on Dec 02, 2002 at 10:33 UTC
    Perl/Tk provides all of the above and is reasonably easy to use.

    It works well under Unix and Windows and uses the default window style under each.

    It comes standard with the Activeperl distribution, available for Windows, Linux and SOlaris.

    --
    Regards,
    Helgi Briem
    helgi AT decode DOT is

Re: Most portable way of GUI programming?
by alfie (Pilgrim) on Dec 02, 2002 at 13:37 UTC

    I would suggest you to take a look at the GIMP Toolkit, too. It is available for quite some platforms (any un*x flavour, win32 and beos for a start) and IMHO looks much better than that Tk -- especially it is themeable to make it look like you want it :-)

    --
    use signature; signature(" So long\nAlfie");

      While Perl works on Windows, and GTK+ works on Windows, getting Perl and GTK+ to work on Windows is quite hard. I was searching for information on it a few days ago and everything I found indicated that no one had gotten it to work yet. Most of the messages I found were more than a year old, though, so things might be better now.

      If you want to use GTK+, the best solution might be to suck it in and use C for the GUI and Perl for the backend.

Re: Most portable way of GUI programming?
by professa (Beadle) on Dec 02, 2002 at 14:08 UTC
    Thanks, people!

    I think I'll have a look at Tk, wx and GTK and choose afterwards which one I use.
    All three need installation of "non-standard" modules, so there's no difference here between the 3 approaches. Right now I like the wx the best, but I'll skip thru the documentation of all packages and decide then.
    Thanks a lot again!

Log In?
Username:
Password:

What's my password?
Create A New User
Domain Nodelet?
Node Status?
node history
Node Type: perlquestion [id://216811]
Approved by belg4mit
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others avoiding work at the Monastery: (2)
As of 2022-09-25 04:06 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?
    I prefer my indexes to start at:




    Results (116 votes). Check out past polls.

    Notices?