Scrollable Tkinter widget not threadsafe?

abli abli at freemail.hu
Wed Jun 18 20:29:50 CEST 2003


The exception you get is 

RuntimeError: Calling Tcl from different appartment

You have to do all calls to tkinter from one thread. 
In the example you give, you create the widget, then start a new thread
which enters mainloop. This means that you try to use two threads to
communicate with Tkinter, which causes the exception.
By moving all tkinter calls, i.e. the lines
  root=Tkinter.Tk()
  FrameScollTest (root).pack(fill='both',expand=True)
into show_widget(), it runs fine.
    
Of course, this has nothing to do with the type of widget you want to use,
a Tkinter.Label behaves the same way.

Abel Daniel




More information about the Python-list mailing list