Archive of UserLand's first discussion group, started October 5, 1998.

Re: Writing GUI apps on Unix

Author:Dan Lyke
Posted:12/7/1998; 9:24:14 AM
Topic:Zope vs. Frontier
Msg #:904 (In response to 841)
Prev/Next:903 / 905

First off, resist the temptation. There are plenty of GUI apps already, and I'd much rather use a new application as a tie-in to a tool I'm already familiar with than to bring up yet another freakin' window. Also, it's easier to script apps that aren't written as GUIs. There's a reason pipes work as well as they do, and there's a reason that any text file can be a shell script if you set the execute bit and put a little bit of info in the first line.

However, it is actually fairly easy to write GUI apps, the problem is choosing the one true way. The simplest way to start is to make your app a module to Tcl and write the UI in Tcl/Tk. Or just use Tk on its own or as bound to numerous other languages. If you have Tcl/Tk installed (most people do), type "wish" (the Tcl/Tk shell), then enter:

button .quit -text "Quit this app" -exec exit

pack .quit

And you've just written your first Un*x GUI app. The advantage to this is that it'll then be fairly easy to port to NT or Mac or whatever. Put those two lines in a text file, and add the line:

#!/usr/bin/wish

to the top of it, do a "chmod x filename", and bang, you've got a Tcl program that runs from any command line.

There are three other options for APIs to use. Qt just loosened their licensing and become a force. GTK is the API that GIMP uses. Motif (or Lesstif) if that licensey corporate world appeals.




This page was archived on 6/13/2001; 4:46:20 PM.

© Copyright 1998-2001 UserLand Software, Inc.