0

I'm using OS X Mavericks with system Python 2.7.

I installed PyGObject, GTK+ and glade as I descripted below, but Python doesn't see gtk.glade module.

All libraries from Homebrew:

brew install libglade
brew install gtk+
brew install pygobject

Also, I set PYTHONPATH in .bash_profile to:

export PYTHONPATH=/usr/local/lib/python2.7/site-packages

When I run Python and try import pygtk or gtk - all works fine. But when I try to load gtk.glade I get no module error.

So I'll try install pygobject with --verbose mode and I noticed, that installer couldn't find libglade:

checking for LIBGLADE... no
…
The following modules will be built:
atk
pango
pangocairo
gtk with 2.24 API
gtk.unixprint

The following modules will NOT be built:

gtk.glade

I assumed that pygobject installer can't find path to libglade (which is installed to /usr/local/Cellar/libglade/2.6.4).

How and what path should I change? Or what else to do?

Thanks in advance!

Kayne
  • 47
  • 1
  • 10

3 Answers3

1

I had exactly the same problem and the following DID NOT work:

brew install --verbose --glade pygtk

But the following DID work on Mavericks with Python 2.7:

brew install --verbose --with-libglade pygtk

See also this discussion

Melissa
  • 168
  • 1
  • 7
  • This needs to be the accepted answer. If you're trying to run old software and need gtk.glade do this. – Juicy Oct 25 '15 at 03:56
0

PyGObject support for Gtk+2 is rater limited as Gtk+2 wasn't created with full Introspection support.

If you're using PyGobject don't use PyGtk, they are different things. In any case, why you need to use libglade? To support old Software? If that's the case, don't use PyGObject, use whatever version the Software was made with.

If you need to parse Glade files to build a GUI, use Gtk+ included GtkBuilder object, libglade was deprecated long long long long ago.

See gi.repository Windows, in particular differences with Gtk+2 and Gtk+3. Also, see How can a program that uses GUI be constructed? for how to build a Glade GUI using PyGObject, Python2.7 and GtkBuilder (this is what I suppose you need).

Community
  • 1
  • 1
Havok
  • 5,776
  • 1
  • 35
  • 44
  • I tried install GTK+3 and PyGobject but everytime I get no gi.repository module problem. Also after installing GTK+3 I noticed that python (2.7.5, system version for Mavericks) doesn't have in sys.path GTK3 - only GTK2. – Kayne Nov 28 '13 at 14:58
0

Need to include the "--glade" config option to Brew when installing, this causes the recipe/formula to make the bindings.

  1. Need to install 'glade'; this will also install 'libglade'
  2. Then install pygtk with the following option "brew install --glade pygtk"
Dan Devine
  • 859
  • 1
  • 8
  • 19