[Israel.pm] Perl GUis

Shmuel Fomberg semuelf at 012.net.il
Thu Dec 7 14:48:01 PST 2006


From: Jason Elbaum
Sent: Thursday, December 07, 2006 11:47 PM

>> Don't compare it to VB or other visual gui-editors. Compare it to
Java's
>> swing and other layout-driven systems.

> I don't know VB or Swing so I can't comment. I'm not comparing Tk to
> anything; I'm just observing its own properties.
> Perl is by nature a compact, concise language. I've hardly ever seen
> Perl/Tk code which is compact or concise. To me, that indicates flawed
> design.

Let me entertain you. Here is a code from Java's Swing, doing a small
"hello world" window:
(taken from:
http://java.sun.com/docs/books/tutorial/uiswing/learn/example1.html)
---- Code start
JFrame frame = new JFrame("HelloWorldSwing");
frame.setDefaultCloseOperation(JFrame.EXIT_ON_CLOSE);
JLabel label = new JLabel("Hello World");
frame.getContentPane().add(label);
frame.pack();
frame.setVisible(true);
---- Code End

It looks surprisingly similar to Tk. In perl you add the minus
parameters, (like "-text") but subtract (in the majority of the cases)
the add commands.

As I see it, for every element in the GUI, you need to declare it, you
need to set some parameters/actions for it, and you need to tell where
and how to put it. If you can say all this in fewer words, show me how.

>> In general, I think that programmer should not do GUI, and leave the
>> design work to the design people.
> Not everyone has "design people" to do GUIs for them.

Me neither. So accept that you GUI is functionality driven, and is ugly.

(or at least, difficult to use. Because we don't know where exactly to
put that label so the user won't ignore it and will click 'next'
automatically.)

Back on the issue that Tk is ugly: it was probably meant to run and look
the same everywhere. And the look that it took (probably from historic
reasons) is of the old UNIXs. Of course it will look better if it's
colorful, but it doesn't mean that it have to look bad. (that's what art
is all about)

Java solved this problem with look-and-feel packs, so you can change how
all your program looks (and feels) in one point. See:
http://java.sun.com/docs/books/tutorial/uiswing/learn/example2.html

Good night,
Shmuel.





More information about the Perl mailing list