Using Tkinter and IDLE with PyPy
We are pleased to announce that Tkinter, the GUI library based on TCL/TK, now
works with PyPy.
Tkinter is composed of two parts:
- _tkinter, a module written in C which interfaces with the TCL world
- Tkinter, a pure Python package which wraps _tkinter to expose the pythonic API we are used to
At the moment, _tkinter is not distributed with PyPy because our build system does not support automatic compilation of C extension. Instead, it is necessary to install it manually, either directly from source or by easy_installing/pip installing tkinter-pypy from PyPI.
For everything to work correctly, you need a recent build of PyPy: the following is a step-by-step guide to install _tkinter in a PyPy nightly build for Linux 64 bit; for other architectures, look at the nightly build page:
$ wget https://buildbot.pypy.org/nightly/trunk/pypy-c-jit-43485-1615dfd7d8f1-linux64.tar.bz2 $ tar xfv pypy-c-jit-43485-1615dfd7d8f1-linux64.tar.bz2 $ cd pypy-c-jit-43485-1615dfd7d8f1-linux64/ $ wget https://peak.telecommunity.com/dist/ez_setup.py $ ./bin/pypy ez_setup.py # install setuptools $ ./bin/easy_install tkinter-pypyOnce you complete the steps above, you can start using Tkinter from your python programs. In particular, you can use IDLE, the IDE which is part of the Python standard library. To start IDLE, type:
$ ./bin/pypy -m idlelib.idleHave fun :-)
Comments
It is sooo ancient. I'd think twice before bundling anything potentially exploitable (read - compiled C modules) with PyPy.
i fail to see how this is more exploitable than say ctypes (which is already shipped)
I'm really REALLY happy about this ... Tkinter, multiprocessing, and 2.7 support were my remaining roadblocks to using PyPy. I'm d/l now to give it a try with Raven Checkers. I hope that I won't need to look back.
I tried to install tkinter on win 7. When I do pypy ez_setup.py I get a traceback that finish with:
File "ez_setup.py", line 212, in main
from setuptools.command.easy_install import main
ZipImportError: 'setuptools.command.install'
Some hint on how to solve it?
@Joaquin:
indeed, ez_setup seems not to work on windows. It might be related to this, although I did not investigate further:
https://bugs.pypy.org/issue725
Instead of ez_setup, you can try to follow these instructions and install distribute/pip, which we recommend anyway nowadays:
https://doc.pypy.org/en/latest/getting-started.html#installing-pypy
Note however that tkinter-pypy is not precompiled for windows, so you need to have the necessary developer tools installed. If you manage to build a precompiled binary of tkinter-pypy, I'd be happy to put it in pypi :-)
Seems that tcl8.4-dev and tk8.4-dev needs to be installed!
This should be insert into the "install instruction" ;)
What does "command 'cc' failed with error 1" mean? I keep getting that upon installing tkinter-pypy
I'm unable to compile it on Windows (MinGW and also tried with VS 2010). Getting the following error:
fatal error: tcl.h: No such file or directory
My TCL installed under a different directory. How can I point the compiler to use tcl.h file from that directory?
I am having an incredible amount of problems attempting to build tkinter for pypy on windows. Is there anywhere I can download a pre built version?
This is outdated. But how to use Tkinter currently under windows?
I think I've managed to compile Tkinter for Windows. Could anyone interested please try it out? Just download this archive and extract it into your Pypy folder:
https://dl-web.dropbox.com/get/Public/Tkinter%20for%20Windows.zip?_subject_uid=29914669&w=AACPaRHDWsfcxafgdXsHV405wJNIsKrYzRXZMHwIKPuiNA&dl=1
XJDHDR: The link is not working. Do you still have the file available to download?
@Luis
The file is still available. Try this link:
https://dl.dropboxusercontent.com/u/29914669/Tkinter%20for%20Windows.zip
Dropbox must have changed something on their end.