Getting wxPython to work on a Mac

T

Timothy Smith

Not sure exactly what I need to do to get wxPython to work on either of
my Macs. (One's a notebook running Tiger (OS X 10.4.11), the other a Mac
Pro running Leopard (10.5.1.))

I downloaded what should be the latest binary, and it installed without
error. So Python comes up as

$ python -V
Python 2.5.1
$ ls -l /usr/bin/python
lrwxr-xr-x 1 root wheel 72 Oct 26 17:59 /usr/bin/python@ ->
.../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python
$

I set PYTHONPATH to
System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5

The Python interpreter works OK, far as I can tell. wx sort of works,
but all the functionality is not there. For example, working through the
exercises in "WxPython in Action" by Noel Rappin, I find that while I
can create and display a frame, and create an app, stuff like
wx.MessageBox() just doesn't work.

The same exercises work just fine on a Python 2.5.1 installation on my
wife's Windows XP machine.

Any help appreciated. (I am obviously both a Python and a Wx beginner.
And not much of a Unix expert either. :)
 
C

cmpython

Not sure exactly what I need to do to get wxPython to work on either of
my Macs. (One's a notebook running Tiger (OS X 10.4.11), the other a Mac
Pro running Leopard (10.5.1.))

I downloaded what should be the latest binary, and it installed without
error. So Python comes up as

$ python -V
Python 2.5.1
$ ls -l /usr/bin/python
lrwxr-xr-x 1 root wheel 72 Oct 26 17:59 /usr/bin/python@ ->
../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python
$

I set PYTHONPATH to
System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5

The Python interpreter works OK, far as I can tell. wx sort of works,
but all the functionality is not there. For example, working through the
exercises in "WxPython in Action" by Noel Rappin, I find that while I
can create and display a frame, and create an app, stuff like
wx.MessageBox() just doesn't work.

The same exercises work just fine on a Python 2.5.1 installation on my
wife's Windows XP machine.

Any help appreciated. (I am obviously both a Python and a Wx beginner.
And not much of a Unix expert either. :)

If you don't get an answer here, you should try the wxPython mailing
list:
http://www.wxpython.org/maillist.php
I'm sure they'll be able to help you out (I don't have a Mac, so I
don't know).
 
P

Piet van Oostrum

Timothy Smith said:
TS> Not sure exactly what I need to do to get wxPython to work on either of
TS> my Macs. (One's a notebook running Tiger (OS X 10.4.11), the other a Mac
TS> Pro running Leopard (10.5.1.))
TS> I downloaded what should be the latest binary, and it installed without
TS> error. So Python comes up as
TS> $ python -V
TS> Python 2.5.1
TS> $ ls -l /usr/bin/python
TS> lrwxr-xr-x 1 root wheel 72 Oct 26 17:59 /usr/bin/python@ ->
TS> ../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python
TS> $

Did you also install the latest wxPython, with the proper version,
corresponding to your python version?
TS> I set PYTHONPATH to
TS> System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5

Why would you do that?
TS> The Python interpreter works OK, far as I can tell. wx sort of works,
TS> but all the functionality is not there. For example, working through the
TS> exercises in "WxPython in Action" by Noel Rappin, I find that while I
TS> can create and display a frame, and create an app, stuff like
TS> wx.MessageBox() just doesn't work.
TS> The same exercises work just fine on a Python 2.5.1 installation on my
TS> wife's Windows XP machine.

I tried the example (python_compare.py) and it just works, including the
MessageBox, on Tiger with python 2.5.1. I run the in Terminal (pythonw
python_compare.py) both with and without your PYTHONPATH.

How did you run the examples?
 
C

Chris Mellon

Not sure exactly what I need to do to get wxPython to work on either of
my Macs. (One's a notebook running Tiger (OS X 10.4.11), the other a Mac
Pro running Leopard (10.5.1.))

I downloaded what should be the latest binary, and it installed without
error. So Python comes up as

$ python -V
Python 2.5.1
$ ls -l /usr/bin/python
lrwxr-xr-x 1 root wheel 72 Oct 26 17:59 /usr/bin/python@ ->
../../System/Library/Frameworks/Python.framework/Versions/2.5/bin/python
$

I set PYTHONPATH to
System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5

The Python interpreter works OK, far as I can tell. wx sort of works,
but all the functionality is not there. For example, working through the
exercises in "WxPython in Action" by Noel Rappin, I find that while I
can create and display a frame, and create an app, stuff like
wx.MessageBox() just doesn't work.

The same exercises work just fine on a Python 2.5.1 installation on my
wife's Windows XP machine.

There's a note at the top of the downloads page - the current wx
binary is built against MacPython, not the python that ships with 10.5

That said, 10.5 ships with wx 2.8.4, which is reasonably recent and
actually more recent than the book, so you should be pretty much okay
without any downloads.

I'm not sure if 10.5 ships with the scripts and applications for
wxPython - if not, you should download the "docs and demos" package
for 2.8.4 and test with those, especially PyShell and friends.

Specific details about what doesn't work (including the script you're
running and how you're running it) are welcomed if this doesn't help.
 
T

Timothy Smith

TS> I set PYTHONPATH to
TS> System/Library/Frameworks/Python.framework/Versions/2.5/lib/python2.5

Why would you do that?[/QUOTE]

Don't know, as it's not clear (to me) from the documentation whether
PYTHONPATH has to include a path to the regular Python modules, or only
to one's own modules. Just fishing here.
I tried the example (python_compare.py) and it just works, including the
MessageBox, on Tiger with python 2.5.1. I run the in Terminal (pythonw
python_compare.py) both with and without your PYTHONPATH.

How did you run the examples?

I tried them using just python and also pythonw. Same (lack of) results.

I will try going back to the OS X 10.5 distribution of Python. Will have
to do a reinstall, I suppose.
 

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

Forum statistics

Threads
473,968
Messages
2,570,149
Members
46,695
Latest member
StanleyDri

Latest Threads

Top