Stan Kolpakoff
Stan Kolpakoff

Reputation: 3

How to install graphics.py on Ubuntu 12.04 for Python3.2

I am a beginning python enthusiast, self-teaching myself from the book of John Zell. I reached the point where I need to learn about objects and about graphics. So, I followed instructions and saved graphics.py into /usr/lib/python3/dist-packages

However, I got his:

import graphics Traceback (most recent call last): File "/usr/lib/python3.2/tkinter/init.py", line 40, in import _tkinter ImportError: No module named _tkinter

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "/usr/lib/python3/dist-packages/graphics.py", line 151, in import tkinter as tk File "/usr/lib/python3.2/tkinter/init.py", line 42, in raise ImportError(str(msg) + ', please install the python-tk package') ImportError: No module named _tkinter, please install the python-tk package

During handling of the above exception, another exception occurred:

Traceback (most recent call last): File "", line 1, in File "/usr/lib/python3/dist-packages/graphics.py", line 153, in import Tkinter as tk ImportError: No module named Tkinter

I checked and it seems that tkinter is installed. Please kindly help me to go around it, because I dont know what to do next.

Thank you so much!

Upvotes: 0

Views: 2574

Answers (1)

TheoretiCAL
TheoretiCAL

Reputation: 20571

You problem: usr/lib/python3/dist-packages/graphics.py

line 153, in import Tkinter as tk 

In Python 3+, Tkinter is imported as tkinter. Simply edit the graphics.py file to import tkinter as tk. Note: As Bender stated, it will probably be easier to continue learning with python 2.*, as you may encounter further issues in the future.

Upvotes: 1

Related Questions