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

Experienced monks,

Over the years, more so recently than in the past, I have written numerous GUI applications in Tk. Some were as easy as a grid of labels, others, complicated with self-rolled widgets, some using the Grid() manager, others Pack() or Place(). Each placement manager has their own strengths and weaknesses which I will not be discussing here.

What I would like to ask though is have you had any experience with WYSIWYG like programs to simply draw/drag-drop/configure widgets for those more complicated GUIs. So far, I've found SpecPerl, a project based on SpecTcl. However, SpecPerl has it's short comings - it is based solely on the grid geometry and has to go through Tcl to produce Tk. Are there any other alternatives (and writing the code by hand is certainly an option, but I was more interested in doing a quick click-drop-and-run solution)?

Replies are listed 'Best First'.
Re: Perl/Tk WYSIWYG
by kvale (Monsignor) on Jun 03, 2004 at 18:03 UTC
    As the author of SpecPerl, I agree that it has limitations. Only the grid manager is available and it doesn't have menus as a builtin. It started out as a simple user-freindly GUI builder that never got developed into a full visual IDE.

    To clear up a possible confusion, SpecTcl (and thus SpecPerl) is an application written in Tcl/Tk, but the resulting GUI is in pure Perl/Tk--no Tcl needed.

    There is an application, Guido, on Sourceforge that is supposed to be a further development on SpecTcl, but I haven't heard much from them lately. In the Tcl world, there is Visual Tcl (vtcl) which is a nice GUI builder with menus, megawidgets, etc. I have not heard of a Perl backend for it, however.

    To my knowledge, there is no free GUI builder for Perl/Tk written in Perl itself.

    It you have been programming in Perl/Tk for a year, it might be easier just to hand code the GUI yourself. Despite being involved with SpecPerl (which was a wonderful Tcl/Tk and Perl/Tk learning experience), I code graphical apps by hand nowadays.

    -Mark

Re: Perl/Tk WYSIWYG
by argggh (Monk) on Jun 03, 2004 at 20:45 UTC
    If you're willing to consider Gtk as your GUI platform, there's glade and Gtk::GladeXML. I think it's rather nifty, but then I'm not esthetically compatible with Tk at all.
Re: Perl/Tk WYSIWYG
by Dr. Mu (Hermit) on Jun 04, 2004 at 03:04 UTC
    Hi. My name is Phil, and I'm a recovering Visual Basic programmer. I was hooked on visual IDEs. But once I discovered Perl/Tk, I swore off WYSIWYG-style GUI designers for good, and at last I've got control back in my programming. It's just so much more precise to specify in code exactly how I want my windows to look. Plus, it's my code, not some cryptic boilerplate dropped into my script by a "visual" window designer. And besides, not all of Tk's rich feature set could easily be accomodated in a drag 'n' drop regimen. For example, can you imagine trying to drag a widget around a container managed by pack? It would require the jaws of life! Well, that's my story anyway. I hope, with the support of my fellow Monks, that I can remain clean of WYSIWYG -- one script at a time.

      This statement calls attention to one of my long-standing irritations with software in general, and Code Delopment IDEs in particular. The irritation is what I call the all-or-nothing phenomenon.

      Although I can relate to the musings of Dr. Mu (aka Phil), I do not agree that the concept of WYSIWYG is all bad. The notion that all code should be painstakingly 'hand crafted' is tenuous at best. The problem is, WYSIWYG tools tend to be 'all or nothing' ... that is to say, there are a lot of tedious minor tasks that I would not mind having 'wizards' or 'drag and drop' options for code generation. The problem is most tools want you to do *everything* inside the WYSIWYG, or they assume too much.

      The bottom line: 'componentized' GUI interfaces are necessary. I should be able to use a GUI IDE the same way I use pipes and redirection in the shell. It's feasible, its doable, but certain people just don't seem to 'get it'.

      It doesn't have to be this difficult people!!

Re: Perl/Tk WYSIWYG
by Courage (Parson) on Jun 04, 2004 at 04:25 UTC
Re: Perl/Tk WYSIWYG
by thunders (Priest) on Jun 04, 2004 at 02:18 UTC

    One nice WYSIWYG i've played with is QtDesigner, which can be configured with a plugin to use PerlQt bindings instead of C++ . take a look at this screenshot. The project page is here. It's similar to visual basic, in it's interface. I prefer Qt's clever SIGNAL()/SLOT() event model to toolkits that use callbacks.

    I believe PerlQt only works on UNIX platforms, and under Cygwin.

Re: Perl/Tk WYSIWYG
by Anonymous Monk on Jun 04, 2004 at 13:29 UTC
    VPTK is a wonderful WYSIWYG. It's written in Perl and it's free. It works both on Win32 and X$. Check this out along with other tools and scripts at: http://www.perltk.org/ex/index.htm. I've been playing with Komodo, by Active State lately. It has a GUI which uses the GRID geometry. No Pack or place! It's not bad either.
      I think implementing a WYSIWYG editor for pack() is very hard. And place() should not be used at all, only in very special circumstances using relative values or for quick'n'dirty scripts.
Re: Perl/Tk WYSIWYG
by zentara (Cardinal) on Jun 04, 2004 at 16:37 UTC
    I agree with Dr. Mu. The boilerplate code produced by those IDE's is harder to deal with than it's worth.

    I was the same way when I started up with Tk GUI's. Man I wanted something like VB, with all the options and callbacks available thru right-click option menus. But after realizing I was spending more time trying to decipher all the triple_underscores and other boilerplate techniques for auto-code generation, I just started to do it manually. It only takes going thru a few examples to get the hang of it. The biggest trick is to learn how to use frames, lots and lots of frames, frames in frames, frames of frames.....etc. You can quickly setup whatever you want, then go back and fill in the callbacks.


    I'm not really a human, but I play one on earth. flash japh
      As an aside, this is why I find Gtk::GladeXML so nifty. Although you can get glade to produce fill-in-the-blanks code for you, I always just keep the xml file around and let Gtk::GladeXML instantiate the dialogs directly from that. Program logic can be associated with graphical elements either by hand with signal_connect or en masse with the rather cool signal_autoconnect_from_package.

      (I see there's now glade2 and Gtk2::GladeXML as well, which is probably more hip.)

        Yeah, I liked Glade when I tried it. Also the new PerlGTK2 interface is really being "perfected" by that team of programmers. I have been impressed by how smoothly it now installs, and all the demos work.

        If only the docs for PerlGTK2 were as good as for Perltk. :-)


        I'm not really a human, but I play one on earth. flash japh
Re: Perl/Tk WYSIWYG
by mawe (Hermit) on Jun 04, 2004 at 16:20 UTC
    Hi!
    Have a look at www.perltk.org. There is a list of some graphical editors.