<html><div style='background-color:'><DIV class=RTE>The application below has two buttons, 'count' and 'stop'.</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>When the 'stop' button is selected after 'count', it does not execute until the count command finishes at 500.  Instead, it is desired to stop counting immediately and execute the 'stop' method.</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>Is there a simple way to handle this situation?</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>I notice Application() objects have a asyncevents(onoff) method in the Macintosh Library Module, but I am a PC, Windows user.</DIV>
<DIV class=RTE> </DIV>
<DIV class=RTE>from Tkinter import *</DIV>
<DIV class=RTE>class Application(Frame):<BR>    def __init__(self, master=None):<BR>        Frame.__init__(self, master)<BR>        self.grid()<BR>        self.createWidgets()</DIV>
<DIV class=RTE>    def createWidgets(self):<BR>        self.stop = Button(self,text='Emergency Stop!',command=self.stop)<BR>        self.count = Button(self,text='Count',command=self.count)</DIV>
<DIV class=RTE>        self.count.grid(row=0,column=0)<BR>        self.stop. grid(row=0,column=1)</DIV>
<DIV class=RTE>    def count(self):<BR>        for i in range(501):<BR>            print i</DIV>
<DIV class=RTE>    def stop(self):<BR>        print 'stop'</DIV>
<DIV class=RTE>app = Application()<BR>app.mainloop()</DIV></div></html>