tkinter broken for threaded Python on both pypy2 and pypy3
Created originally on Bitbucket by christopherthemagnificent (Christopher Johnson)
I have a very large multi-threaded Python 3 and Tkinter project that I want to move to PyPy 3.
While moving my code over, I discovered that PyPy is broken in supporting threads.
So I made a small test program that demonstrates the bug. Here is the output displayed when running the program:
$ pypy3 tkintertest.py Exception in thread secondary: Traceback (most recent call last): File "/Users/christopher/bin/pypy3-2.4.0-osx64/lib-python/3/threading.py", line 740, in _bootstrap_inner self.run() File "/Users/christopher/bin/pypy3-2.4.0-osx64/lib-python/3/threading.py", line 693, in run self._target(*self._args, **self._kwargs) File "tkintertest.py", line 11, in secondary canvas.create_text(100, 50, text="Secondary thread") File "/Users/christopher/bin/pypy3-2.4.0-osx64/lib-python/3/tkinter/init.py", line 2256, in create_text return self._create('text', args, kw) File "/Users/christopher/bin/pypy3-2.4.0-osx64/lib-python/3/tkinter/init.py", line 2232, in _create *(args + self._options(cnf, kw)))) File "/Users/christopher/bin/pypy3-2.4.0-osx64/lib_pypy/_tkinter/app.py", line 286, in call raise NotImplementedError("Call from another thread") NotImplementedError: Call from another thread
I cannot run my project on PyPy unless this gets fixed, and I cannot code around it, so I wish you all luck in working on this issue!
By the way, I tried running my test on PyPy 2 (with the Tkinter module name changed to capital T) and it failed with the same identical output. So PyPy 2 also need to be fixed.
I am running this on OS X 10.9.5 Mavericks. With the following displayed when I run PyPy interactively: Python 3.2.5 (b2091e973da6, Oct 19 2014, 18:30:58) [PyPy 2.4.0 with GCC 4.2.1 Compatible Apple LLVM 6.0 (clang-600.0.51)] on darwin