[ILUG] What language?
David Golden
david.golden at unison.ie
Sun Feb 4 23:32:22 GMT 2007
On Sunday 04 February 2007 03:25, Timothy Murphy wrote:
> What is the best language in which to write a simple GUI application,
> in the opinion of the ILUG gurus?
>
That depends. AJAX techniques (which I'm sorely tempted to start
calling DHTML++ from now on :-) ) as some other posters have suggested,
are, when you get right down to it, still pretty flakey hackery really,
IMNSHO. Yeah, there are frameworks to hide some of the nastiness, but
meh.
The venerable tk is easy to learn, widely available, and will enable you
to make a low-overhead (by modern standards) cross-platform gui with
very little effort indeed.
Small caveat: you need to use the 8.5 development branch to get
antialiased fonts and such on linux (i.e. greatly reduce the "tk apps
look like arse" problem) and some of the more modern widgets on all
platforms (at least in core-integrated form - most of them were
previously add-on widgets).
While tcl as a language might or might not drive you up the wall, tcl/tk
is still a particularly fast way to throw together a simple GUI app,
particularly control GUIs for some $THINGY you've just made.
(and you don't have to use tcl just because you're using tk anyway,
python and perl and other language bindings exist).
Yeah, it mightn't be "hip and groovy" like you youngsters say, but it
has one great advantage - it Just Works.
Here's a "hello world" GUI in tcl/tk. This is not supposed to be
"good code", more an example that took minutes to write. I imagine
someone who has never seen tcl/tk code before could get the gist of
what it does...
#!/usr/bin/wish
#lpick: pick randomly from list, see http://wiki.tcl.tk/1549
proc lpick list {
lindex $list [
expr { int( rand() * [llength $list] ) }]}
set insults {
Poopyhead
Moose
Pig
{Filthy Meat Human made of Meat}
{Arsenal Fan}
{Windows Weenie}
{Mac Muppet}
{Linux Lover}}
set mycaption "Hello, World!"
set clickcount 0
button .b -textvariable mycaption -command {
incr clickcount
if {$clickcount < 20} {
set insult [lpick $insults]
set mycaption "Hello, $insult!"
} else {
exit }}
pack .b
More information about the ILUG
mailing list