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

The majority of what ive seen with perl is all dos based. Are there any modules that lets you do graphical user interfaces on all platforms for either the terminal or a windows based platform?

Replies are listed 'Best First'.
Re: GUI on all platforms
by wazoox (Prior) on Apr 15, 2006 at 13:31 UTC
    There are quite a lot of GUI modules, most of them are cross-platform. Here comes a non-exhaustive list :
    • Tk Is by far the most common. It's a bit rough at the edges, but does the job.
    • Tcl::Tk is nearly identical to Tk, but somewhat faster. Why both exist is beyond my understanding though...
    • Gtk is the perl interface to GTK1 libraries. It's nicer than Tk, but harder to get running on Windows and MacOS X.
    • Gtk2 is the perl interface to the GTK2 library. It's very nice, but has the same problem than Gtk of course.
    • QT is the perl interface to the Tolltech QT C++ toolkit. It's pretty nice and equivalent to Gtk2.
    • wxPerl is the interface to the wxWidgets toolkit. wxWidget is a very cool library with a native look-and-feel on all platforms : windows, OS X, X11/Motif or X11/Gtk. It's a bit difficult to install and evolves rapidly, though it's a bit difficult to get on.
    • Tk::Zinc is a special beast : it's somewhat based upon Tk but it has great OpenGL capabilities and is very good looking, and fast. Try it!
    • There are platform-dependant wrappers too, like the Win32::Gui (the name says it all), CamelBones Obj-C wrapper for Mac OSX/Cocoa, etc.
      • Well that's all I think of at the moment, friends. If you want go the easy way, choose Tk; if you want something good-looking and very cross-platform, check wxPerl; if you need something graphically powerful Tk::Zinc is the best choice IMHO.

      as a maintainer of Tcl::Tk module, I want to shed a light on your mention "Tcl::Tk is nearly identical to Tk, but somewhat faster. Why both exist is beyond my understanding though...".

      In few words, because perl/Tk was implemented in unusual (read: wrong) way
      To expand, usually other languages (ruby, python, etc) and other GUI libs (Gtk, QT, etc) do *not* include entire GUI lib into extension, while perl/Tk did.
      This leads to a problem of harder maintenance and harder incorporations of new features.
      I, personally, was stuch with lack of Unicode few years ago, and moving to Tcl::Tk was a must for me.

      Also another module on CPAN makes similar job but it do not follow perl/Tk syntax.

      On a different note - I was impressed on QT. Although it is not acceptable for me (due to $cost for commercial usage) I was impressed by its quality: QT on my Set-top-box, satellite receiver, based on Linux and having only 32Mb of memory, was unbeleiveable fast and lightweight and damn good... (compared to Gtk+)

        Yes, but you can write off QT support in Perl.

        The QT 3 bindings are third-party and somewhat stale, and there's no evidence we are going to see QT 4 bindings.

        Even the Perl people INSIDE of TrollTech can't QT bindings, I've spoken to them.
      You missed Prima.


      TGI says moo

        Well, I've said it's a "non-exhaustive list" :)
Re: GUI on all platforms
by Zerhash (Scribe) on Apr 15, 2006 at 05:39 UTC
    Perl-Tk should be able to do that for you. As windows style goes
      what will do the terminal though?
Re: GUI on all platforms
by jcoxen (Deacon) on Apr 15, 2006 at 12:54 UTC
    The most prevalent cross-platform gui these days is via a web browser. As long as you don't go for something VERY graphic intensive and interactive (AJAX) even text-based web browsers like Lynx can use it.

    Jack

Re: GUI on all platforms
by vkon (Curate) on Apr 15, 2006 at 06:36 UTC
    Not much GUI are on text-based.

    I only know of "curses", but there's no "window"-based counterpart.

    However, there exists an Tcl extension Ck, which uses same syntax for text-based and window-based interfaces.

    It should be usable from Perl with Tcl module, and I had ideas to try this, but didn't due to low practical sence...

Re: GUI on all platforms
by swampyankee (Parson) on Apr 15, 2006 at 21:13 UTC

    To answer your question in a manner which is both entirely accurate, and fairly useless, "Yes." As a bit more useful answer, there are several, of which the Tk module is probably, overall, the easiest to use.

    By "terminal" do you mean remote access or do you mean as a command line program?

    Incidentally, it's quite incorrect to refer to Perl as "dos based" Perl originates from the Unix world, and is command-line based.

    emc

    "Being forced to write comments actually improves code, because it is easier to fix a crock than to explain it. "
    —G. Steele
Re: GUI on all platforms
by bowei_99 (Friar) on Apr 15, 2006 at 10:28 UTC
    Well, if you know java, you could embed java as inline code, using any of the java CPAN modules. Personally, I think java is overkill for a lot of situations, but I have noticed some recent applications I've worked with where it's actually not dog-slow. One benefit would be that the user wouldn't have download and install Tk, since the JVM is already on many systems out there.

    -- Burvil

Re: GUI on all platforms
by mattr (Curate) on Apr 16, 2006 at 07:16 UTC
    > either the terminal or a windows based platform For terminal consider something like Curses::UI

    For GUI consider Tk (see above) or wxPerl.

    Tk has been around for ages and is still popular. wxPerl is based on the wxwidgets C++ cross-platform gui framework.

    There are other options too it seems, though I mainly have experience with wxPerl. The framework itself is highly popular, also being used straight from C++ or from python, and the wxPerl mailing list is very active.