Set up a working Python+GTK+ environment on Win32 (outdated)

Download and install almost all .zip files from http://gimp.org/win32.

I used mingw32:

  • MinGW-3.1.0-1.exe
  • MSYS-1.0.10.exe
  • msysDTK-1.0.1.exe

Create a .profile:

PATH="/target/bin:/c/Python23:$PATH"

CFLAGS="-mno-cygwin -mms-bitfields -I/target/include -I/c/Python23/include"

LDFLAGS="-L/target/lib -L/c/Python23/libs"

PKG_CONFIG_PATH=/target/lib/pkgconfig

CVS_RSH=ssh

export PATH CFLAGS LDADD PKG_CONFIG_PATH

and restart the shell.

Now it's Python time:

Install pexports (pexports-0.42h.zip)

$ pexports /c/WINDOWS/system32/python23.dll >python23.def
$ dlltool.exe --def python23.def --output-lib libpython23.a
$ cp libpython23.a /c/Python23/libs/

$ tar zxf pygtk-2.10.0.tar.gz
$ cd pygtk-2.10.0

Add the gtk+ bin diretory to the path.

Change Python include directory from $.../include/python$version to $.../include

$ CFLAGS="-I /c/Yirdis/Python24/include -I /c/workspace/python/gtk/include" LDFLAGS="-L /c/workspace/python/gtk/lib" ./configure 

Open a DOS-hell (cmd):

> cd \msys\1.0\home\arjan\pygtk-2.10.0
> set PATH=c:\Python23;c:\MinGW\bin;c:\msys\1.0\target\bin;%PATH%

pygobject:

> python setup.py --yes-i-know-its-not-supported build_ext --compiler=mingw32

> python setup.py build --compiler=mingw32

> python setup.py install --skip-build

> python setup.py --yes-i-know-its-not-supported install --prefix=c:\workspace\python\gtk --skip-build

pycairo:

> python setup.py install --prefix=c:\workspace\python\gtk

pygtk:

Copy c:\python23\lib\pkgconfig\pygtk*.pc to the other pkgconfig dir (c:\msys\1.0\lib\pkgconfig)

Now PyGTK should work (open a Python interpreter and import pygtk, gtk and create a Window).

Attachments