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

hey there PM!!

i reading the tk vs wx thread and also installed gtk2 cpan module

this is really neat stuff if you ask me, but i would want to find easy to deploy crossplatform solutions.
so i ask you monks: what do you people use for cross platform frontends?
pitfalls combinations & solutions etc would be appreciated!!

Replies are listed 'Best First'.
Re: cross platform gui's
by graff (Chancellor) on Oct 18, 2003 at 17:37 UTC
    I suspect that all three of the choices you mentioned (tk, wx, gtk) might be equally easy to deploy across different systems -- or equally hard, depending on your attitude/abilities (and the attitude/abilities of the people being deployed to) regarding the installation of non-core Perl modules.

    Actually, that might not be exactly correct: Tk is definitely easy to port, and while I haven't tried it, wx is probably just as easy; gtk might be a problem on some systems. But another consideration is ease of (programmer) use: Tk tends to be really well documented, and it has been the most heavily used over the years (hence a broader base of community experience to draw on).

Re: cross platform gui's
by vek (Prior) on Oct 18, 2003 at 20:22 UTC

    If your main concern is deploying crossplatform solutions then I wouldn't look too hard at Gtk because if it's dependancy on Gnome. Tk on the other hand is certainly a good candidate for behaving on multiple platforms. Not only that, it is well established, well supported, and there's a ton of code out there (just do a search for Tk on CPAN to see what I mean).

    If you do decide to go the Tk route, picking up a copy of Mastering Perl/Tk would certainly be worth your while.

    -- vek --
Re: cross platform gui's
by jdtoronto (Prior) on Oct 19, 2003 at 02:55 UTC
    My experience has been that Tk is the most stable and portable of the GUI's available in Perl. Wx is a wrapper for WxWIndows, you need to install it directly on Windows as there is no PPM for it.

    I have done a handful of small tools in Tk and just recently a much alrger stand-alone application using an MySQL database (or optionally Postgres). I wrote it on Windoes under ArtiveState 5.8.0 and tested it without changes on 5.6.1 on Linus using MySQL. It has now been used with no modification on Linux, Solaris, HP-UX, OS-X, Windows XP, 200 and NT4 with Postgres being used on a linux machine. Now, that is what I call true portability.

    Tk is more cumbersome to write as we don't yet have the GUI interface builders. It has a wonderful range of widgets and you can easily customise your own or build mega-widgets. Wx looks nice, but I couldn't get it working on my Linux development box. Prima is nice and worked first time on my Windows machine, but was flaky under Linux. Ad mittedly I had little time to mess around, Tk worked and so I stuck with it. GTK/GTK2 I have not tried, purely through lack of time!

    jdtoronto

Re: cross platform gui's
by batkins (Chaplain) on Oct 19, 2003 at 02:14 UTC
    I would definitely recommend Tk. It works well on both Windows and Linux, and there's an ActiveState PPM for Tk.

    Also, as others mentioned, Tk is a standalone module. You just install Tk and you have a working GUI toolkit. Wx and Gtk are both thin wrappers over external libraries, so you'll need to install either wxWindows or Gtk to make them work.
    Take a look at this node for more information.


    The computer can't tell you the emotional story. It can give you the exact mathematical design, but what's missing is the eyebrows. - Frank Zappa
      ... there's an ActiveState PPM for Tk.

      You just install Tk and you have a working GUI toolkit. Wx and Gtk are both thin wrappers over external libraries, so you'll need to install either wxWindows or Gtk to make them work.

      Why is that important? All the Tk author does is bundle the required Tk files ... you can always build a statically linked Wx (or probably Gtk for that matter).

      wxPerl binaries are readily available for perl 5.6 and up, in both unicode and non-unicode flavors. In order to get perlTk with unicode support you need at least perl 5.7.

      MJD says "you can't just make shit up and expect the computer to know what you mean, retardo!"
      I run a Win32 PPM repository for perl 5.6.x and 5.8.x -- I take requests (README).
      ** The third rule of perl club is a statement of fact: pod is sexy.

        Because Nick merged the Tcl/Tk code into Perl/Tk very well. There's a lot of Perl support code around the Tk core to make the Perl interface nicer. For instance, the Tk callback system is entirely customized for Perl and the object-orientedness of Perl/Tk is completely absent from Tcl/Tk. So instead of having to find an appropriate version of the library your toolkit needs, it's already been integrated into Perl/Tk. Something like Wx is still very C++-ish, which is fine if that's what you want. But I think that by including a particular version of Tk in Perl/Tk and then making a heavy Perl wrapper around that, the code becomes more usable and the install a little simpler.

        The computer can't tell you the emotional story. It can give you the exact mathematical design, but what's missing is the eyebrows. - Frank Zappa