You are not logged in.

#1 2009-11-23 21:50:16

Loafers
Member
Registered: 2009-11-01
Posts: 92

[SOLVED] Tkinter won't load

Hi,
I am learning Python on my own using Prof. Zelle's textbook Python Programming: An Introduction to Computer Science.  I'm on Chapter 5 Objects and Graphics and I cannot import the graphics.py that is used by the book.

Textbook Excerpt wrote:

To make learning easier, I have written a graphics library (graphics.py) for use with this book. This library is freely available as a Python module file and you are welcome to use it as you see fit. Using the library is as easy as placing a copy of the graphics.py file in the same folder as your graphics program(s). Alternatively, you can put graphics.py in the system directory where other Python libraries are stored so that it can be used from any folder on the system.

But I  get this error when I do:

[loafers@arch temp]$ python
Python 2.6.4 (r264:75706, Oct 27 2009, 06:16:59) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import graphics
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "graphics.py", line 149, in <module>
    import Tkinter as tk
  File "/usr/lib/python2.6/lib-tk/Tkinter.py", line 39, in <module>
    import _tkinter # If this fails your Python may not be configured for Tk
ImportError: libtk8.5.so: cannot open shared object file: No such file or directory
>>>

Looking at the error, I'm guessing my Python may not be configured for Tk and I don't have libtk?  I'm new and very confused and can't do anything in this chapter without this graphics.py sad  Any help would be appreciated.

Regards,
Loafers

Last edited by Loafers (2009-11-24 01:24:13)

Offline

#2 2009-11-23 21:56:13

Speek
Member
Registered: 2005-04-07
Posts: 36

Re: [SOLVED] Tkinter won't load

You probably just need to install tk: 'pacman -S tk'.

Offline

#3 2009-11-23 22:05:44

Loafers
Member
Registered: 2009-11-01
Posts: 92

Re: [SOLVED] Tkinter won't load

Speek wrote:

You probably just need to install tk: 'pacman -S tk'.

Thanks!  I figured something like that and tried python-tk, tkinter, etc

Offline

#4 2009-11-23 23:20:24

Xyne
Administrator/PM
Registered: 2008-08-03
Posts: 6,963
Website

Re: [SOLVED] Tkinter won't load

Thanks for marking this thread as solved, but could you please include the original subject, e.g. "[SOLVED]Tkinter won't load". The title "[solved]" is not descriptive and doesn't help others who are searching for this.


My Arch Linux StuffForum EtiquetteCommunity Ethos - Arch is not for everyone

Offline

#5 2009-11-24 01:42:57

skottish
Forum Fellow
From: Here
Registered: 2006-06-16
Posts: 7,942

Re: [SOLVED] Tkinter won't load

Thanks to both Loafers and Xyne.

Offline

#6 2015-07-09 14:08:49

wandy
Member
Registered: 2015-02-27
Posts: 20

Re: [SOLVED] Tkinter won't load

The thread is marked SOLVED without a clear answer.  I got  the same problem and the answer is as Speek pointed:

 sudo pacman -S tk 

Offline

#7 2015-07-09 14:21:33

Scimmia
Fellow
Registered: 2012-09-01
Posts: 11,544

Re: [SOLVED] Tkinter won't load

necrobumping is bad form, necrobumping just to repeat the given answer is very bad form.

https://wiki.archlinux.org/index.php/Fo … bumping.22

Offline

#8 2015-07-09 15:04:17

WorMzy
Forum Moderator
From: Scotland
Registered: 2010-06-16
Posts: 11,845
Website

Re: [SOLVED] Tkinter won't load

Closing, for the reasons listed by Scimmia.


Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD

Making lemonade from lemons since 2015.

Offline

Board footer

Powered by FluxBB