On Wed, 12 Dec 2007 02:58:37 +0100, mariox19 <[EMAIL PROTECTED]> wrote:
> Are Tkinter widgets running on their own thread? No. And usually, GUI toolkits and threads don't mix well... > If I try to make a simple application that will print the letters A to > Z to a Tkinter Text widget, and I space the printing of each letter by > 1 second, it seems no text will appear in the Text widget until the > method exits. > > Take a look at this snippet: > > # Assume I have created no threads other than the one that comes > with Main > > def printToTkinterTextWidget(text): > """ > Prints A-Z to the Text widget, 1 letter per second. > """ > # Problem: no text appears in the widget until 26 seconds has > elapsed > for aNumber in range(65, 91): > self.textWidget.insert(END, text) > time.sleep(1) time.sleep will not give back the control to the Tkinter mainloop, so your text widget won't be refreshed on screen. Try: self.textWidget.update_idletasks() before the sleep. HTH -- python -c "print ''.join([chr(154 - ord(c)) for c in 'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])" -- http://mail.python.org/mailman/listinfo/python-list