/* jquery */ /* jquery accordion style*/ /* jquery init */

22 April 2013

Learn Python - Installing Tkinter

Python 3.x

If you're using a recent version of Python 3, say version 3.5 or 3.6, then the tkinter module is preloaded. So you can move on to the next step in this tutorial.

Python 2.7

However, if you're using Python 2.7 then you might need to install the Tkinter module.

To check if it's already installed open a new Python interactive session, then enter this statement (making sure there's an uppercase T in Tkinter):

>>> import Tkinter

Did you see an    ImportError: No module named Tkinter    error message?

If the answer is yes then follow the installation steps below (which presume you're running the Raspbian Jessie distro or the older Raspbian Wheezy image).

Connect the Raspberry Pi to the Internet, open an LXTerminal window and enter this command:

sudo apt-get install python-tk

If prompted enter the your login password, and reply y to any prompts.

Now we're ready to create GUI apps.

A post from my Learn Python on the Raspberry Pi tutorial.