Alec Solway wrote: > If so, then why does the following work? What actually calls bar() below? > > foo = Tk() > def bar(): > print "bar" > foo.after(1000, bar) > # Drop back to prompt with 'after#0' response
drop back to prompt? are you running this in interactive mode? the CPython interactive mode provides a "background event loop" that keeps Tkinter's event loop running. this is useful when tinkering when UI stuff from the command line, but is nothing you can rely on for code that you run outside the interactive mode. (you cannot rely on it in interactive mode either; it only works on Unix if you're using the readline library, and only works on Windows if you don't type anything into the window. as soon as you touch the keyboard, the event loop is terminate). to solve your problem, use an ordinary Python thread, and use a Queue object to pass results from the background thread to the main Tkinter thread. </F> _______________________________________________ Tkinter-discuss mailing list Tkinter-discuss@python.org http://mail.python.org/mailman/listinfo/tkinter-discuss