Adding the ----- lines seems to work. > from Tkinter import * > import time > > def on_button(): > for J in range(10): > print J > if CancelNow: > break > time.sleep(1) ------ Root.update() > > def Cancel(Event): ------ global CancelNow > print 'Cancelling now' > CancelNow = True > Root.quit() > > Root = Tk() > Root.bind_all('<Key-Escape>',Cancel) > > B = Button(Root,command=on_button,text='Go') > B.pack() > CancelNow = False > > Root.mainloop()
_______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss