At 07:59 AM 11/15/02 -0700, Stephen Levings wrote:
>Does anyone have suggestions as to how to abort procedures when using
Tkinter?
>
>I don't want to put polling loops into the procedures as that is tedious 
>and does not lend itself to generalization. I would like to do something 
>like raise an exception in a separate thread but don't know whether it can 
>be done or how to do it.

There's one easy way that may do what you want - make your own
Tkinter.mainloop()
You can roll your own event loop using Tkinter's dooneevent

TCL_ALL_EVENTS          = 0

        while self.exit < 0:
            self.root.tk.dooneevent(TCL_ALL_EVENTS)
            except SystemExit:
                #print 'Exit'
                self.exit = 1
                break
             ...

This has the added advantage of avoiding the 20msec. sleep in the 
_tkinter mainloop C code (a big bug IMHO).

For a more complete example of this mainloop replacement, see
the CVS version of python/Demo/tix/tixwidgets.py - the mainloop/quit
code is not Tix specific.

Mike.

_______________________________________________
ActivePython mailing list
[EMAIL PROTECTED]
To unsubscribe: http://listserv.ActiveState.com/mailman/mysubs
Other options: http://listserv.ActiveState.com/mailman/listinfo/ActivePython

Reply via email to