in reply to Is there a really perlish user interface module, or something?

It can be frustrating switching from an API you know well to one you don't. But Tk has been around a while and will probably do what you want.

For example, take your dialog box example. There is a messageBox method that is nearly as simple.

$answer = $mw->messageBox( -message => 'Are you sure you want to quit?', -title => 'Demo dialog', -type => 'YesNo', -icon => 'question', -default => 'yes' );
If that is still too much typing, put it in a sub with the customized defaults you desire. I do not know how to both derive a title from a main window and not have the dialog derived from a main window; pick one.

As for your browse widget, I've never needed such a thing, but you may want to check out the ListBox widget (chapter 7 of Mastering Perl/Tk is devoted to ListBoxes). Finally, I don't see what is preventing you from validating responses with regular expressions; on the contrary, this is usually encouraged as good defensive coding.

I always thought of the perl/Tk interface as melding very nicely with the rest of perl. The interface has a natural hierarchical, OO structure and after playing with some widgets, it is pretty easy to guess what is needed with new widgets. It does what I mean.

That said, I can see room for improvement. Tk has always been beautiful enough for me, but I recognize that others are more sensitive to GUI fashions. For instance, it would be nice for Tk widgets to be more easily skinnable, in the fashion of GNOME or KDE widgets.

Update: I forgot to mention that the Tab key allows keyboard traversal of widgets in a window.

-Mark

  • Comment on Re: Is there a really perlish user interface module, or something?
  • Download Code

Replies are listed 'Best First'.
Re^2: Is there a really perlish user interface module, or something?
by Shenpen (Beadle) on Aug 08, 2004 at 21:36 UTC
    Thank you very much for answering.

    Actually... I know you guys here are used to get practical tha t need practical, "what to do" questions, but my question is not one of them... :-) Currently I'm much more interested in the theoretical side of the stuff: you have a programming language, which is really very well optimalized for the common case, f.e. the archetypical
    while (<>) { split /;/

    programs, which I consider really wonderful and a masterwork of reality-based programming language design. And besides you have a user interface library that totally does not reflect this philosophy. Based on the above example, Perl should have a message function, which if supplied no arguments, then throws a message box of an empty title, a text of $_ , and a button of OK. See my point? That would be perlish.

    This is a big contradiction, and I simply don't understand why.

    Thanxalot again,

    Shenpen