On Jun/02, Dennis Lee Bieber wrote: > On Sat, 2 Jun 2012 14:57:17 +0200, Matteo Landi <mat...@matteolandi.net> > declaimed the following in gmane.comp.python.general: > > > > Lesson learned: never invoke Tkinter functions / methods outside the > > mainloop > > thread.. NEVER! > > > > Typically, that advice would apply to ANY GUI library... > > The exception being operations that /add/ an event to the pending > unprocessed GUI events, thereby signaling the GUI to perform the desired > function.
You right, definitely! I made a bit of GTK programming before, and if I remember correctly, there is a *thread-safe* function, `gobject.idle_add`, that let you queue functions to be executed by the main thread. For that reason, I thought it was safe to invoke `tk.after_idle` outside the mainloop's thread, but oviously I was wrong! > > If you want a head-ache... Try coding an application in which the > old GKS is used for the main data display (I needed display-list > capability with identified "segments" so I could "blank"/"show" > different aspects of the data -- without rerunning some 15-minute > process read months of data points) on top of a nearly raw X-Window > systems (xt and DECWindows). AND the graphics commands for the data to > be plotted were coming in as ASCII text over a VMS mailbox. Oh, and no > threading -- the graphics commands had to be processed a few at a time > via an xt idle event handler (if there were no GUI events, call my > handler to read a command from the mailbox, dispatch to the GKS > emulation of the command [the commands mapped to Ramtek 9300 graphics > engine -- the original implementation], and return to check for next > event). This was ca. 1990! > Nice, good job! > > > -- > Wulfraed Dennis Lee Bieber AF6VN > wlfr...@ix.netcom.com HTTP://wlfraed.home.netcom.com/ > > -- > http://mail.python.org/mailman/listinfo/python-list Cheers, Matteo -- http://www.matteolandi.net -- http://mail.python.org/mailman/listinfo/python-list