Using Tkinter and IDLE with PyPy
Originally published on the PyPy blog.
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 :-)