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

good stable GUI library?

by bcrowell2 (Friar)
on Oct 19, 2005 at 22:04 UTC ( #501448=perlquestion: print w/ replies, xml ) Need Help??
bcrowell2 has asked for the wisdom of the Perl Monks concerning the following question:

Howdy,

Having written a fairly significant GUI app using Perl/Tk, I'm not sure I'd choose it again. It seems to have a lot of bugs, and also there's a tendency for my app to break every time a new version of Perl/Tk comes out. What's a good, stable, well tested GUI interface to Perl? Gtk-perl? I assume gtk2-perl is more bleeding edge? Anyone tried wxPerl? (I don't really care about having it be cross-platform, though.)

TIA!

Ben

Comment on good stable GUI library?
Re: good stable GUI library?
by xdg (Monsignor) on Oct 19, 2005 at 22:14 UTC

    I'd also be interested in people's opinions about Prima. It's supposedly written in Perl for Perl rather than being a port of/interface to another GUI toolkit.

    -xdg

    Code written by xdg and posted on PerlMonks is public domain. It is provided as is with no warranties, express or implied, of any kind. Posted code may not have been tested. Use of posted code is at your own risk.

Re: good stable GUI library?
by TGI (Vicar) on Oct 20, 2005 at 02:02 UTC

    It's been a while since I looked at this, but I wound up choosing to use Tk because, IMHO, the docs were better. Now that my app has grown in complexity, I do seem to be finding some bugs and some holes in the docs.

    GTk looked very interesting and I got some simple demos working. Docs were OK, but I found them confusing, as I didn't really have much GUI hacking experience.

    I found pretty much the same things when I checked out WxPerl. WxPerl is nice because I could make native GUIs for Mac OS X (pTk and Gtk-perl require X11). I found the docs for WxPerl to be very lacking. There was a wiki, but it had been targeted by spammers and I couldn't find much useful information there. The philosophy seemed to be that one should be able to read the native documentation and figure out how to call the library from perl.

    Of course, it's been nearly a year, and things may have changed. Good luck.


    TGI says moo

      WxPerl is nice because I could make native GUIs for Mac OS X (pTk and Gtk-perl require X11).
      And I believe perl/tk doesn't work at all on older versions of MacOS X, so choosing perl/tk means locking out users who haven't stayed on the $130/version upgrade treadmill. My perl/tk app was meant to be cross-platform, but I ended up deciding not to support it any more on any platform but Linux, because supporting Windows users was eating up large amounts of my time, and it was an open-source project that I wasn't making any money on. No matter how cross-platform one of these toolkits is supposed to be, I think making an app cross-platform still requires an order of magnitude more maintenance work once the app is mature. I've also soured on the whole idea of bringing OSS to the Windows-using masses -- I think it just sucks energy out of the OSS movement, and there's no real return on the investment, because those folks are happy with Windows, and are going to keep on using it.
        I don't typically downvote; however, I disagree with the sentiment about bringing opensource to Windows. I'm not going to turn this into a flame war, so I'm going to try and be concise:

        People who use FireFox/Thunderbird, Gaim, OpenOffice and VLC on Windows, will have a much easier time converting to Linux. By advocating these specific pieces of software I can make a move away from any one operating system much more seamless. I do believe in dropping support for archaic software, and for that I accept a downvote or two. On a modern site, targetting a modern audience, I would support a modern browser. I use CSS2.0 often, CSS1 & XHTML all the time, I only support IE 6.x and FF 1.x, and nothing more. (Though I expect my site to "work" for some degree on all recent browsers, because everything validates as strict.)

        If this was C++, I would suggest looking into GLUT/OpenGL. GTK qualifies as 'portable-enough' for me.


        Evan Carroll
        www.EvanCarroll.com
Re: good stable GUI library?
by Ace128 (Hermit) on Oct 20, 2005 at 10:22 UTC
    What are the bugs? Can you give me some examples? Myself have done rather big apps using Perl/Tk, and I havent notice any "bugs"...
      Seconded.


      --
      Regards,
      Helgi Briem
      hbriem AT simnet DOT is
      The biggest problems I've had have been with new releases of Perl/Tk breaking old code. For instance, here's a patch I had to make because Tk804.025 broke my app:
      2915c2924,2926 < sub{$self->clicked_on_assignment($self->{ASS_KEYS}->[$ass_ +lb->curselection()])} --- > # sub{$self->clicked_on_assignment($self->{ASS_KEYS}->[$as +s_lb->curselection()])} > # ... used to work, but no longer does > sub{$self->clicked_on_assignment($self->{ASS_KEYS}->[$name +_to_key{$ass_lb->get($ass_lb->curselection())}])}

      Of course, it's always possible that I was depending on behavior that was actually not supposed to be documented and reliable behavior. I'd have to go back and look at the docs I was using (the O'Reilly Mastering Perl/Tk book) and see.

      Well, here's a recent example that's near and dear to my heart, I recently discovered that using the widgets as HList items, when one deletes an item using $HList->delete('all'), if the item has any widget entries, they will not be destroyed. Perhaps I am wrong in assuming that this should happen, but there is nothing in the documentation to lead me to believe that behavior should be otherwise. If I destroy a widget, it's children should be destroyed as well. I was under the impression that deleting an item (or an entry) was equivalent to destroying it.

      With the Optionmenu widget, if you use an option list like [[label1=>1],[label2=>2]] you cannot simply set the -variable option, if you want the correct value displayed, you must also set the -textvariable option. If you only set the variable, the value in the variable will be overwritten by the first item in the option list.

      These may be bugs, or they might be deficiencies in the docs. I don't care, I just don't like having to experiment to discover these behaviors.


      TGI says moo

      Tk804.027 delivered with Perl 5.8.7 doesn't render accented chars in Tk::Text properly. It's on windows, don't know if it's same on unix OS. So one has to downgrade Perl to older versions.
      Generally no problem but for instance when you intend to use PAR to make an executable using Tk and DBD::CSV as in my case, I came across a bug which crashed the exe. Only the latest PAR version with Perl 5.8.7 worked without crashing but this combination renders garbled chars.

      rahed
Re: good stable GUI library?
by zentara (Archbishop) on Oct 20, 2005 at 11:05 UTC
    The last time I looked at Wx, it needed Gtk2 underneath it. I just setup the latest version of Gtk2-perl, and I must say it is awesome. It is the future. The big advantage of gtk2-perl over perl/tk is it has a constant, underlying library which has a cohesive design. Tk on the other hand is sort of a "hodge-podge" of widgets. The docs for gtk2-perl are still lacking, but you can see it coming together.

    I envision that eventually there will be a very good GUI-designer program written for it, which will surpass Glade in functionality and bring it on par with Visual C/C++.

    Tk is still easier for a beginner to learn, and gain the satisfaction of setting up a simple gui frontend for themselves, and Tk is still the closest thing to "cross-platform" out there. When someone wants Tk on Windows, it's an easy answer....ActiveState. Gtk2 is not so easy on Windows.

    From the underlying libraries which are being developed, it seems that the choices are Gtk2 or Qt. Considering how popular Qt is (KDE etc), there sure isn't much interest in the perl bindings to the Qt libs. So that leaves Gtk2, which has very active development in the perl bindings.


    I'm not really a human, but I play one on earth. flash japh
      ...there sure isn't much interest in the perl bindings to the Qt libs.

      Just to add, there are perl bindings for Qt version 3, which had a different license than version 4 (e.g. version 3 had only a commercial license for Windows and version 4 has a restricted free license for Windows). Sounds like version 4 would be more desirable, but from what I've read it would require a complete rewrite to come up with the perl bindings, and no one's come up with the tuits yet (update: there is a RubyQt for version 4). The author of Perl/Qt also came up with a PerlKDE, but that also requires old libraries, and hasn't been updated for a while.

      I read this as an endorsement of Gtk2 for perl GUIs. Is that correct? At this point I am getting very frustrated with Tk, and I am very interested in other options.

      You say that it isn't easy to use Gtk on windows. What are the problems with windows? It looks like there is a PPM archive. So, while building your own code might be painful, are there any gotchas with using the "official" binaries?

      How hard is it to port from Tk to Gtk2? Are there any good porting guides? I found one for going from GTK to Gtk2.


      TGI says moo

        Tk's widget set is built-in; Gtk2 is a binding to an external library. The problems with Gtk2 on Windows pretty much stem from that. There are PPMs on the gtk2-perl website, but they don't include the gtk+ runtime, so you have to get that set up, too.
Re: good stable GUI library?
by mattr (Curate) on Oct 22, 2005 at 12:46 UTC
    I've done the same survey you're doing now a number of times, to see how things are getting along stably. There are a number of interesting kits and if you are into games then maybe sdl-perl but I would like to recommend WxPerl. A number of monks use it too.

    WxPerl seems to be quite stable and is constantly growing. It is based on wxwidgets, which is a very widely used system with lots of docs, third party modules, etc. So WxPerl wraps nearly all the functions in the base kit. People can add modules, it's on CPAN and in a public CVS, basically it's very workmanlike. The wxwidgets.org docs and site in general is all extremely comprehensive and very useful, that's my main docs. I think the more people who get into wxperl the better, it will create more GUI tools for us in CPAN and provide more people to wrap, test and use new wxwidgets modules. Incidentally there is a good list of apps built with wxwidgets and also with wxperl. Maybe you want to ask Jouke or someone else why they like wxperl.

    You do need to get used to the basic idea since the most powerful part is you can make your own perl package based on a standard window or control, and then use that customized widget or window. There are sizers for automatic layout and so on. You can use Glade or a commercial layout program for some GUI design of your apps. There is a demo program to show you how basic things are done, and an XRC system for building widgets at runtime.

    I have not used perl gtk though a look at a tutorial on it makes it looks somewhat similar, since you do basically the same things. So far I haven't hit my head against anything and the docs and support for wxperl are pretty impressive. Now there are some things I've thought about, like having video and transparencies, and I don't know if wxperl can do that. There is an unwrapped video module for example, and wxperl can do Active X and OpenGL. I think it can do shaped windows but don't remember. Basically it's not gorgeous, I wouldn't mind a more beautiful interface, but it gets the job done and it seems to have the critical mass. I wanted to use TkZinc quite badly for a while but decided not to when (at the time, not any longer) it was unstable on WinXP.

    For some reason I looked through Prima a few times and decided against it. If I wanted to do some fast animation I might now consider sdl-perl or even gtk-perl, but I'm designing one large project now and it will definitely be in wxperl. Hope this helps. Update: For what it's worth, I was extremely interested in DigiStrips and the mention about perl-anim in the OpenATC (now TkZinc) project. But the combination of opaque liscensing requirements and apathetic documentation really killed it for me. The DigiStrips are draggable live simulations of paper strips used in the French air traffic control simulation that started off OpenATC and even now I really would like to have them. The apparently fast and beautiful demo they made (only a couple screenshots but stunning) made me hunger badly. I will still go look at TkZinc another few times I expect but will perennially be wondering about animation or video and the modules they must have built. All that would be massively useful for the community if it was just opened, after all it is just their prototype, they aren't going to actually run the tower in perl. I think.

Log In?
Username:
Password:

What's my password?
Create A New User
Node Status?
node history
Node Type: perlquestion [id://501448]
Approved by ghenry
Front-paged by TGI
help
Chatterbox?
and the web crawler heard nothing...

How do I use this? | Other CB clients
Other Users?
Others imbibing at the Monastery: (6)
As of 2014-04-18 11:04 GMT
Sections?
Information?
Find Nodes?
Leftovers?
    Voting Booth?

    April first is:







    Results (466 votes), past polls