Re: [Tutor] On GUI's

Magnus Lycka magnus at thinkware.se
Wed Apr 21 13:13:02 EDT 2004


Chad Crabtree wrote:
> I just wanted to make a comment about GUI programing.  I recently was trying
> to make a command line menu driven text console for a little project.  I
> found the complexities of that system greatly outwieghed the same in GUI's
> especially Tkinter.  I was just mentioning this for those people new to GUI
> programing that yes they are wierd but I believe all UI's are fiarly
> difficult to implement.  Especially as they become more feature rich.

Very true. One of the Unix Philosophy tenets is to avoid captive
user interfaces in general. We have become used to these user
interfaces where we interactively walk through menues and fill in 
forms. Maybe it's better to think outside this paradigm.

For instance, let's imagine that we have a program where we report
our working hours, and what project we worked on. The typical WIMP
approach might be a GUI app where we can choose beween a list view
where we can view, delete, edit, add entries, and an add/edit window
with labels, text entry fields and a few buttons. Something like
this (you need a fixed font to view this...)

/--------------------------------------\
|          +-----------+               |
| Employee |           |               |
|          +-----------+               |
|          +-----------+               |
| Project  |           |               |
|          +-----------+               |
|          +----------+                |
| Date     |____-__-__|                |
|          +----------+                |
|          +--------+       /------\   |
| Start    |__:__:__|       | Save ||  |
|          +--------+       \======//  |
|          +--------+       /------\   |
| Stop     |__:__:__|       |Cancel||  |
|          +--------+       \======//  |
\--------------------------------------/

A competely different approach is to make a non-interactive program 
which for instance acts on command line switches -l (for list entries), 
-r (for remove entry) and -a (for add entry).

We can imagine something like this:
$ timereport.py -l -uMagnus -d2004-04-19
1234, "The Oregon Project", 08:14:10, 11:34:00
1235, "Adminstration", 11:34:00, 13:00:00
1236, "The Oregon Project", 14:14:10, 19:34:00

$ timereport.py -r1235

$ timereport.py -l -uMagnus -d2004-04-19
1234, "The Oregon Project", 08:14:10, 11:34:00
1236, "The Oregon Project", 14:14:10, 19:34:00

$ timereport.py -l 1236
employee: Magnus
project: The Oregon Project
date: 2004-04-19
start: 14:14:10
stop: 19:34:00

(This we can redirect to a file)

$ timereport.py -l 1236 > temp.txt

$ edit temp.txt 

(Change the text file as you like in your editor)

$ timereport.py -r1236

$ timereport.py -a temp.txt

$ timereport.py -l -uMagnus -d2004-04-19
1234, "The Oregon Project", 08:14:10, 11:34:00
1237, "The Oregon Project", 14:00:00, 19:45:00

You might think that this is a very old fashioned and primitive
way of working, just as my five year old son thinks it's very
primitive and old fashioned to actually learn how to read and
write when there are telephones and TV (and parents who can read
for you). ;)

Actually, I suspect that you'd work faster with this system
than with a GUI system. You can have a fixed file that you just
double click on to edit, and then you can just double click on
another icon to do "timereport.py -a timeentry.txt", and
click on a third which is a tiny bat-file containing:

timereport.py -l -uMagnus > timelog.txt
notepad.exe timelog.txt

Whatever...

Apart from being as easy to use as soon as you get used to it,
it will be much faster to develop, and much, much more flexible
regarding further development than any application with a captive
user interface.

It would be easy to write a program (in Python or some other language)
that provided an email interface for this, so that you can just send
emails to a certain address to get them registered in the database. The
email system would use just the same interface as you do. Same thing
with a web interface, or an interface that allows you to report time
through your mobile phone. No big deal. Try to write a program that
recieves SMS messages from a GSM phone and enters the data in the
message into a system with only a GUI interface!

-- 
Magnus Lycka, Thinkware AB
Alvans vag 99, SE-907 50 UMEA, SWEDEN
phone: int+46 70 582 80 65, fax: int+46 70 612 80 65
http://www.thinkware.se/  mailto:magnus at thinkware.se



More information about the Tutor mailing list