Installing Python & PyGTK on Mac OsX

Recently i have been asked to develop an application that will work on Linux, and Mac os, so i started developing it on my Ubuntu, i chosed Python as the programming language and PyGTK as the GUI for it.

The application worked fine on my Ubuntu, but when i moved it to Mac OSx (Leopard), i had a problem importing the PyGTK module and the program GUI didn’t run. so i tried to install PyGTK from sources with all its dependencies, but after spending a day doing so i ended up with many errors in compiling the dependencies and finding them.

after some search i found out that i can do this using MacPorts.

so here is the steps i followed :

- Install X11 http://guide.macports.org/#installing.x11

- Install Xcode tools http://guide.macports.org/#installing.xcode

- Install MacPorts http://guide.macports.org/#installing.macports

- Make sure the paths are configured in your shell profile http://guide.macports.org/#installing.shell

- Restart your shell, and follow the next commands :

1- Install Python

sudo port -v install python25

2- Install Python select

sudo port -v install python_select

3- Activate our installed python version

sudo python_select python25

4- Install pygtk

sudo port -v install py25-gtk

5- Install some gnome themes and engines

sudo port -v install gnome-themes
sudo port -v install gtk-nodoka-engine
sudo port -v install gtk-smooth-engine
sudo port -v install gtk2-aurora
sudo port -v install gtk2-clearlooks
sudo port -v install gtk2-extra
sudo port -v install gtk2-industrial
sudo port -v install gtk2-murrine

6- Install theme switch

sudo port -v install gtk-theme-switch

7- Select which theme to be used by your applications by running the theme switch

switch2

Now you can have the applications you develop using python and pygtk running smoothly on mac os leopard.