Python on Max osx and tkinter

R

Ralf Wieseler

Hello! I'm quite new to Python.

I wrote some little scripts using the "import from tkinter" Statemant
that work well on Windows and Linux. but if i try to execute them in my
Powerbook with Mac OSX 10.2.8 i get only Errors. I imorted the TKinter
Module with the Package Manager of MacPython 2.3 but it doesn't work.
My Macphython has no idea of TKinter.
Whats wrong?

Thanks for any help!

Greetz Ralf
 
R

Ron Stephens

Ralf Wieseler said:
Hello! I'm quite new to Python.

I wrote some little scripts using the "import from tkinter" Statemant
that work well on Windows and Linux. but if i try to execute them in my
Powerbook with Mac OSX 10.2.8 i get only Errors. I imorted the TKinter
Module with the Package Manager of MacPython 2.3 but it doesn't work.
My Macphython has no idea of TKinter.
Whats wrong?

Thanks for any help!

Greetz Ralf

Hmm, I also had problems gettign Tkinter properly installed on early
versions of Mac OS X. I finally did succeed, but it was difficult and
I'm not sure I can tell you what the secret was ;-(((

My best advice is to install the latest version of Mac OS X10.3
(Panther). I was successful installing Tkinter on Panther the first
time with no difficulties.
 
R

Russell E. Owen

Ralf Wieseler said:
Hello! I'm quite new to Python.

I wrote some little scripts using the "import from tkinter" Statemant
that work well on Windows and Linux. but if i try to execute them in my
Powerbook with Mac OSX 10.2.8 i get only Errors. I imorted the TKinter
Module with the Package Manager of MacPython 2.3 but it doesn't work.
My Macphython has no idea of TKinter.
Whats wrong?

What I did that worked on Jaguar:
- Installed MacPython 2.3 for Jaguar using the binary installer from:
<http://homepages.cwi.nl/~jack/macpython/macpython-osx.html>
- Installed Tcl/Tk 8.4.4 using the binary installer from
<http://www.maths.mq.edu.au/~steffen/tcltk/TclTkAqua/>
- Used Package Manager (in /Applications/MacPython) to install _tkinter
(and also readlines and some other useful stuff)

At that point you ought to be able to open a NEW terminal window (tcsh
caches some info, so an existing window will probably NOT work) and type
"pythonw" (not "python", that would result in a GUI you cannot bring to
the front) and you're in business:

import Tkinter
root = Tkinter.Tk()

should bring up a window. (By the way "import from tkinter" will not
work. The T in Tkinter is capitalized, and I don't think "import from
<package>" is valid python.

If that does not work for you, can you be more specific about how it
fails?



-- Russell

P.S. for Panther, you can use the same technique, but make sure you
install MacPython 2.3 for Panther instead of for Jaguar, or you'll end
up with a mess. Panther already includes a usable MacPython (and two
copies do not coexist well), so the MacPython installer only adds some
extra components.
 
G

George Trojan

Ralf said:
Hello! I'm quite new to Python.

I wrote some little scripts using the "import from tkinter" Statemant
that work well on Windows and Linux. but if i try to execute them in my
Powerbook with Mac OSX 10.2.8 i get only Errors. I imorted the TKinter
Module with the Package Manager of MacPython 2.3 but it doesn't work.
My Macphython has no idea of TKinter.
Whats wrong?

Thanks for any help!

Greetz Ralf
I have Mac OS X 10.3 (7B85). Tkinter that came with the OS does not work
for me:
trojan$ python
Python 2.3 (#1, Sep 13 2003, 00:49:11)
[GCC 3.3 20030304 (Apple Computer, Inc. build 1495)] on darwin
Type "help", "copyright", "credits" or "license" for more information.Traceback (most recent call last):
File "<stdin>", line 1, in ?
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 am a newcomer to Mac, don't know whether this is a build issue (shared
library for _tkinter was not linked) or a configuration problem.
I guess I will have to build another version, after installing Tk and X11.

George
 
A

Aahz

What I did that worked on Jaguar:
- Installed MacPython 2.3 for Jaguar using the binary installer from:
<http://homepages.cwi.nl/~jack/macpython/macpython-osx.html>
- Installed Tcl/Tk 8.4.4 using the binary installer from
<http://www.maths.mq.edu.au/~steffen/tcltk/TclTkAqua/>
- Used Package Manager (in /Applications/MacPython) to install _tkinter
(and also readlines and some other useful stuff)

Thanks! That's a clear explanation that probably ought to be on the
MacPython page. (Haven't finished yet, but I'll take your word that it
works.)
At that point you ought to be able to open a NEW terminal window (tcsh
caches some info, so an existing window will probably NOT work) and type
"pythonw" (not "python", that would result in a GUI you cannot bring to
the front) and you're in business:

``rehash`` ought to find ``pythonw``
 
R

Ralf Wieseler

Russell said:
What I did that worked on Jaguar:
- Installed MacPython 2.3 for Jaguar using the binary installer from:
<http://homepages.cwi.nl/~jack/macpython/macpython-osx.html>
- Installed Tcl/Tk 8.4.4 using the binary installer from
<http://www.maths.mq.edu.au/~steffen/tcltk/TclTkAqua/>
- Used Package Manager (in /Applications/MacPython) to install _tkinter
(and also readlines and some other useful stuff)

At that point you ought to be able to open a NEW terminal window (tcsh
caches some info, so an existing window will probably NOT work) and type
"pythonw" (not "python", that would result in a GUI you cannot bring to
the front) and you're in business:

import Tkinter
root = Tkinter.Tk()

should bring up a window. (By the way "import from tkinter" will not
work. The T in Tkinter is capitalized, and I don't think "import from
<package>" is valid python.

If that does not work for you, can you be more specific about how it
fails?



-- Russell

P.S. for Panther, you can use the same technique, but make sure you
install MacPython 2.3 for Panther instead of for Jaguar, or you'll end
up with a mess. Panther already includes a usable MacPython (and two
copies do not coexist well), so the MacPython installer only adds some
extra components.
Thanks for your great help. That explains a lot of my troubles with
MacPython. a very useful statement. It realy should be on the MacPython
Webside cause i guess there are many people "fighting" with Tkinter and
MacPython!!
I'm really happy now!!
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,767
Messages
2,569,572
Members
45,045
Latest member
DRCM

Latest Threads

Top