signal

Donn Cave donn at u.washington.edu
Tue Aug 1 18:04:12 EDT 2000


Quoth Thomas Thiele <thiele at muc.das-werk.de>:
|> It depends an awful lot on what you're doing, both in "update some things"
|> and in the rest of the program.  select() with timeouts works well in
|> some multiple task situations, more useful and reliable than alarm()
|> and I believe more portable.  Commonly you'd use this approach where
|> the program spends its time waiting for input on a socket.
|>
|
| But with select the program waits until timeout. So I need a thread.
|
| It's an Tkinter-GUI and it must be ready for userclick.
| And sometimes it has to ask for some other datas.

OK, I have no experience with Tk, but I imagine like other X11
toolkits it has its own select(), watching the X socket connection.
I believe it allows you to add your own data sources to that with
a createfilehandler() function.  I would give you about even odds
that it will work for you on Windows as well as UNIX, it's certainly
possible.  If it doesn't, Windows Tk may export some other dispatching
mechanism that will work.  You should probably post again with a
different subject line that mentions Tk and Windows.

| My temporaer solution is to use a thread and time.sleep.
| But then the program stops at listbox.update() functions....It seem that I
| can't call widget.update() from a outher thread (NT).

Yes, thread rhymes with dread.  I don't know how Windows Tk does it,
but there is probably some kind of event that you can post to the
window thread.  When it gets that event it can look at some storage
object where the results were deposited;  the two threads probably
have to interlock over this storage to prevent simultaneous access.
Too complicated, unless it's the only way or it's a learning exercise.

| For information "update some things" uses a socket connection to a server to
| another host (IRIX) and pickles some data classes through it. (and the server
| answers)
| Then I update my listboxes with this returned datas. This has to be done
| every 10 seconds and the user must be still able to click and write in this
| gui.

I'm sure that's possible somehow!

	Donn Cave, donn at u.washington.edu



More information about the Python-list mailing list