On Wed, May 18, 2011 at 5:01 PM, psao pollard-flamand <psaoflam...@live.com> wrote: > You know when you click a tkinter button and the window usually freezes > until its done? Does any one know how to stop that?
This may or may not fix your problem, depending on your updating problem. Instead of: Button(tkwin, text="Go", command=dosomething) Put instead: def delayedDoSomething(): tkwin.after(100, dosomething) Button(tkwin, text="Go", command=delayedDoSomething) The net effect is taking your button command off the event queue for a bit, letting the button to redraw itself or whatever needs to be done. if the work done by the command invoked by the button is quite cpu intensive, I do somethink like the following: Class XXX(Toplevel): def updateInterface(self): self.updateDisplay() if not self.DONE: self.after(100, self.updateInterface) def doSomething(self): # A flag used by updateInterface to know when to quit self.DONE=False # The following will return, but call itself every second self.updateInterface() # Now do the work for fpath in glob.glob("*.*"): self.processFile(fpath) # next line is important I think to ensure the display proc gets a chance self.update() # work finished, tell updateInterface to quit self.DONE=True _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss