[Tkinter-discuss] Tkinter and Threads
Douglas S. Blank
dblank at brynmawr.edu
Sat Feb 5 00:43:07 CET 2005
Hi, I'm running some Tkinter code that works fine on some machines, but
doesn't on others. The error I get is:
...
File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 2066, in create_oval
return self._create('oval', args, kw)
File "/usr/lib/python2.3/lib-tk/Tkinter.py", line 2049, in _create
return getint(self.tk.call(
RuntimeError: main thread is not in main loop
This code works under Fedora Core 2, Python 2.3.3 with Tkinter 1.177,
but doesn't under Debian, Python 2.3.4, with Tkinter 1.177. I see that
the error is raised in _tkinter.c because the Tk interpreter is in a
different thread from where I am attempting to run this code.
The questions: is this error dependent on whether Tkinter was compiled
with or without threads? If so, is there a way I can, via Python, find
out the method Tkinter was compiled? Is there a workaround for this
problem (short of rewriting my code)? Will going to Python 2.4 alter
this behavior?
The situation is that I create a canvas in a thread, and have another
thread running that calls a callback that updates the canvas.
Thanks for any hints!
-Doug
--
Douglas S. Blank, Assistant Professor
dblank at brynmawr.edu, (610)526-6501
Bryn Mawr College, Computer Science Program
101 North Merion Ave, Park Science Bld.
Bryn Mawr, PA 19010 dangermouse.brynmawr.edu
More information about the Tkinter-discuss
mailing list