Threads and Tkinter GUI ...
Grant Edwards
grante at visi.com
Mon Oct 23 15:24:48 EDT 2000
More information about the Python-list mailing list
Mon Oct 23 15:24:48 EDT 2000
- Previous message (by thread): Threads and Tkinter GUI ...
- Next message (by thread): Threads and Tkinter GUI ...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
In article <39F40343.2978F59B at stud.cs.uit.no>, Arild Hansen wrote: >what I want: When I start the xclient I first create a thread called >"pingServer" which is resonsible for pinging the server at regular >intervals. When this thread is started I start the GUI's mainloop. >I will then have a GUI running and a thread running in the background >pinging the server. If the server is not found, the pingServer thread >will update a global variable and a led light will turn red in the GUI. If I were you, I'd just use the after() method on the top-level window to schedule a function to run every 5 seconds. It's a lot simpler than doing the whole thread thing. I don't seem to have an example handy, but it works something like this (warning, I've been doing pyGtk stuff more recently than Tkinter stuff, so I may have this not-quite-right, so you should probably find a real example or look at the Tk docs): def doSomething(*args): # insert ping code here win.after(5000, doSomething) win = Tk() # set up everything ... # start pinging doSomething() -- Grant Edwards grante Yow! ... Get me a GIN at and TONIC!!...make it visi.com HAIR TONIC!!
- Previous message (by thread): Threads and Tkinter GUI ...
- Next message (by thread): Threads and Tkinter GUI ...
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
More information about the Python-list mailing list