473,320 Members | 2,162 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

OS X and Tkinter

I recently purchased a book to learn python, and am at a part where I
want to start working with GUIs. I have an OS X system, and am using
the default python installed on the system. I have installed Tcl/Tk
Aqua from http://tcltkaqua.sourceforge.net/.

When I run the file called gui.py that contains this:

from Tkinter import *
root = Tk()
root.title("Simple GUI")
root.geometry("200x100")

I get this back:

python gui.py
Traceback (most recent call last):
File "gui.py", line 1, in ?
from Tkinter import *
File
"/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
python2.3/lib-tk/Tkinter.py", line 38, in ?
import _tkinter # If this fails your Python may not be configured
for Tk
ImportError: No module named _tkinter

I have looked everywhere on the net, and can't figure out how to
configure python so that Tkinter will work with it. Any help would be
appreciated.
Mike

Jul 18 '05 #1
4 2601
Mike Tuller wrote:
I recently purchased a book to learn python, and am at a part where I
want to start working with GUIs. I have an OS X system, and am using
the default python installed on the system. I have installed Tcl/Tk
Aqua from http://tcltkaqua.sourceforge.net/.


Download and install

http://www.pythonmac.org/packages/Ma...macosx10.3.zip

It will install the _tkinter extension module.

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
Jul 18 '05 #2
Robert Kern wrote:
Mike Tuller wrote:
I recently purchased a book to learn python, and am at a part where I
want to start working with GUIs. I have an OS X system, and am using
the default python installed on the system. I have installed Tcl/Tk
Aqua from http://tcltkaqua.sourceforge.net/.

Download and install

http://www.pythonmac.org/packages/Ma...macosx10.3.zip


Oops! Wrong one.

http://www.pythonmac.org/packages/_t...macosx10.3.zip

--
Robert Kern
rk***@ucsd.edu

"In the fields of hell where the grass grows high
Are the graves of dreams allowed to die."
-- Richard Harter
Jul 18 '05 #3
>>>>> Mike Tuller <py****@discovercommunityed.com> (MT) wrote:
MT> I recently purchased a book to learn python, and am at a part where I want
MT> to start working with GUIs. I have an OS X system, and am using the
MT> default python installed on the system. I have installed Tcl/Tk Aqua from
MT> http://tcltkaqua.sourceforge.net/. MT> When I run the file called gui.py that contains this: MT> from Tkinter import *
MT> root = Tk()
MT> root.title("Simple GUI")
MT> root.geometry("200x100") MT> I get this back: MT> python gui.py
MT> Traceback (most recent call last):
MT> File "gui.py", line 1, in ?
MT> from Tkinter import *
MT> File "/System/Library/Frameworks/Python.framework/Versions/2.3/lib/
MT> python2.3/lib-tk/Tkinter.py", line 38, in ?
MT> import _tkinter # If this fails your Python may not be configured for
MT> Tk
MT> ImportError: No module named _tkinter MT> I have looked everywhere on the net, and can't figure out how to configure
MT> python so that Tkinter will work with it. Any help would be appreciated.


You need to install Tkinter. The easiest way is to use the Python Package
Manager: http://www.python.org/packman/
--
Piet van Oostrum <pi**@cs.uu.nl>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: pi**@vanoostrum.org
Jul 18 '05 #4
Mike Tuller wrote:
I have looked everywhere on the net, and can't figure out how to
configure python so that Tkinter will work with it. Any help would be
appreciated.


The following worked for me with OSX version 10.3 and the default python
2.3:

http://www.pythonmac.org/wiki/FAQ#he...71cd2e856e81e3

"
5.5 How do I install Tkinter? How do I get IDLE to work?

Here are the steps for installing Tkinter:
• Download and install TclTkAqua
• Download and install the MacPythonPantherAddons if you are using
the version of Python 2.3 included with OS X 10.3
• Open PackageManager, it is located in /Applications/MacPython-2.3
• Install _tkinter

You may then use Tkinter based applications such as IDLE, which should
also be available from PackageManager. Note that if you are running any
sort of GUI application from Terminal, you must use "pythonw" not
"python" to launch the script.

If the PackageManager complains that it cannot open a certain URL at
www.python.org, choose "Open URL" from the "File" menu and open
http://www.python.org/packman/versio...acintosh.plist
instead of the standard URL.
"
Jul 18 '05 #5

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Josh | last post by:
Caution, newbie approaching... I'm trying to come up with a very simple Tkinter test application that consists of a window with a drop-down menu bar at the top and a grid of colored rectangles...
3
by: srijit | last post by:
Hello, Any idea - why the following code crashes on my Win 98 machine with Python 2.3? Everytime I run this code, I have to reboot my machine. I also have Win32all-157 installed. from Tkinter...
1
by: syed_saqib_ali | last post by:
Please take a look at and run the code snippet shown below. It creates a canvas with vertical & Horizontal scroll-bars. If you shrink the window to smaller than the area of the canvas, the...
0
by: syed_saqib_ali | last post by:
Below is a simple code snippet showing a Tkinter Window bearing a canvas and 2 connected scrollbars (Vertical & Horizontal). Works fine. When you shrink/resize the window the scrollbars adjust...
1
by: Michael Yanowitz | last post by:
Hello: Below I have included a stripped down version of the GUI I am working on. It contains 2 dialog boxes - one main and one settings. It has the following problems, probably all related, that...
3
by: dwelch91 | last post by:
I'm trying unsuccessfully to do something in Tk that I though would be easy. After Googling this all day, I think I need some help. I am admittedly very novice with Tk (I started with it...
1
by: yvesd | last post by:
hello i want to intercept tkinter python system events like wm_delete_window and if possible for any window, but the newest code I've produced give me an error : Traceback (most recent call...
8
by: karthikbalaguru | last post by:
Hi, One of my python program needs tkinter to be installed to run successfully. I am using Redhat 9.0 and hence tried installing by copying the tkinter-2.2.2-36.i386.rpm alone from the CD 3 to...
3
by: joshdw4 | last post by:
I hate to do this, but I've thoroughly exhausted google search. Yes, it's that pesky root window and I have tried withdraw to no avail. I'm assuming this is because of the methods I'm using. I...
3
by: J-Burns | last post by:
Hello. Im a bit new to using Tkinter and im not a real pro in programming itself... :P. Need some help here. Problem 1: How do I make something appear on 2 separate windows using Tkinter? By...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.