Re: Python3 + gtk3 on windows



On Thu, 16 Aug 2012 17:12:23 +1000, Jared Henley wrote:
I've finally turned up some useful information in the archive
for this list.  I've downloaded the gtk+ and pygobject binaries
from

http://optionexplicit.be/projects/gnome-windows/GTK+3/

and also installed python 3.2 using the msi installer on the
Python site.  But I don't know where to copy the gtk+ and
pygobject files to the right places to make it all work.

Can someone tell me what to do?

1) those pygobject binaries (and the bundle in gtk+/git/) are
   linked against 32 bit Python 2.7, so you'd need to install
   that first
2) make sure Python27/Lib/site-packages/pygtk.pth is renamed
   to something else as the Gtk3 bundle does not agree with
   the PyGTK aio installer's way of ensuring PATH is set to
   something sane)
3) get the bundle from
   http://optionexplicit.be/projects/gnome-windows/GTK+3/gtk+/git
   and extract it to C:\Gtk3
4) create a C:\Gtk3\bin\pygi.cmd file containing the following:

8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8<
@echo off
set PATH=C:\Gtk3\bin;C:\Python27\;%PATH%
set PYTHONPATH=C:\Gtk3\lib\site-packages
set GI_TYPELIB_PATH=C:\Gtk3\lib\girepository-1.0
C:\Python27\python.exe %*
8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8

Adjust paths to match your installation directories but note
you should avoid spaces in paths completely for both the location
of the bundle and the installation location of Python.

If you want to test pygobject's demos/gtk-demo/gtk-demo.py,
you'll need to patch is like this:

8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8< 8<
from gi.repository import GLib, GObject, Gio, Pango, GdkPixbuf, Gtk

#ugly win32 hack
GLib.file_test = GLib.file_test_utf8
GLib.file_get_contents = GLib.file_get_contents_utf8
GdkPixbuf.Pixbuf.new_from_file = GdkPixbuf.Pixbuf.new_from_file_utf8
#end ugly hack

DEMOROOTDIR = os.path.abspath(os.path.dirname(__file__))
8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8 >8

Note that these binaries:
- are not intended to be used in production systems
- are built with debug symbols (mingw.org's gdb works well)
- are built from the experimental "windows" branches of various
  "forks" on my github page, which are in various stages of not
  yet ready or good enough for upstream
- do not come with any warranty whatsoever, etc

mvg,
Dieter



[Date Prev][Date Next]   [Thread Prev][Thread Next]   [Thread Index] [Date Index] [Author Index]