Andrew writes:
>I'm pretty sure that I understand the event model of doing
>things. It's not that dissimilar to interrupt handler code in
>my embedded work.
>The thing that's making me balk at first is understanding where
>the events are coming from, and under what circumstances they
>will arrive.
And whether they are still relevant.
This is part of the difficulty of doing GUI work.
I mentioned the 'evas' canvas system. Allied with this is ecore:
" Ecore is a nice convenience library. It handles abstracting X calls so
you don't have to pass as many parameters to them. It wraps lots of
other sequences of X calls you want to do often, handles caching local
geometry of windows to save extra X traffic, abstracts X's events and
adds a timer system to be able to do timeouts, handles the core event
loops, abstracts signals into being events in the event queue, and
lets you arbitrarily add other file descriptors to the loop to listen
on and have handlers be called when they become active, and much much
more."
Now, and I'm sorry to be the equivalent of the guitar bore at parties,
I have to mention that there is another great thing about
Tcl/Tk : its event model.
Consider this one line program:
button .b -text "Exit" -command {exit}; pack .b
feed it into wish. The exit is executed on a mouse button press
event over the button.
or this program, that counts down:
label .counter -font {Helvetica 72} -width 3 -textvariable count
grid .counter -padx 100 -pady 100
# Run the countdown
for { set count 10 } { $count >= 0 } { incr count -1 } {
update
after 1000
}
exit
More info on event processing at
http://mini.net/cgi-bin/wikit/489.html
I promise no more Tcl evangalising, unless someone mentions again
an exact thing that is easily done with it.
Jamie
--
SLUG - Sydney Linux User Group Mailing List - http://slug.org.au/
More Info: http://slug.org.au/lists/listinfo/slug