Search Google

Thursday, March 06, 2008

[Python & Tkinter] 瓶頸

似乎在thread中無法create/update widget,應該說還不知道如何正確的辦到這件事情。。。
每次想做這些事情程式就hang住=.=
研究中!

Updated @ 20080310, quoted from Oreilly's Programming Python, 2nd Edition, 2nd paragraph of Chapter 8.7.1

If you do use threads in Tkinter programs, however, only the main thread
(the one that built the GUI and started the mainloop) can make GUI calls. Even
things like the update method described in the previous section cannot be called
from spawned threads in a GUI program -- they'll likely trigger very strange
program crashes. This GUI thread story may be improved in future Python and
Tkinter releases, but imposes a few structural and platform-specific constraints
today.

No comments: