0

In the code file i have to link just one library (from gi.repository import Gtk). But when i run it it replies me:

Gtk-WARNING **: Unknown property: GtkTextView.input-purpose

ERROR --file: collega_GUI --riga: 160, 'Grid' object has no attribute 'get_child_at'

So i tried to find missing libraries:

$ dpkg -l libgtk[0-9]* | grep ^i

ii  libgtk2.0-0    2.24.10-0ubuntu6    GTK+ graphical user interface library
ii  libgtk2.0-bin  2.24.10-0ubuntu6    programs for the GTK+ graphical user interface library
ii  libgtk2.0-common  2.24.10-0ubuntu6     common files for the GTK+ graphical user interface library
ii  libgtk2.0-dev  2.24.10-0ubuntu6    development files for the GTK+ library

and Grid object needs gtk3+, so let's install it:

$ sudo apt-get install libgtk-3-0 libgtk-3-common libgtk-3-dev libgtk-3-doc

0 updated, 0 installed, 0 removed and 0 not upgraded

So it's all fine with libraries and:

  1. gtk-grid-get-child-at exists

  2. GtkTextView--input-purpose exists

  3. that "input-purpose" problem is strange, because on the previous OS (ubuntu 13.10, now i'm on 12.04) i didn't get that problem.

The UI is built by Glade, but i never get that error previously: on the same project files, but on a different OS version.

I still think i need to install some libraries.

EDIT :: ged_child_at function call

griglia = self.__builder.get_object('grid3')
                for i in range(0, 3):
                    area = griglia.get_child_at(i, 0)
                    self.__builder.get_object(Gtk.Buildable.get_name(area)).connect("draw", self.draw)
FrancescoN
  • 2,146
  • 12
  • 34
  • 45
  • possible duplicate of [Python3: How can I find out what version of GTK+ I am using?](http://stackoverflow.com/questions/12541328/python3-how-can-i-find-out-what-version-of-gtk-i-am-using) – drahnr Apr 10 '14 at 23:43

1 Answers1

0

The tag Since 3.6 for that property which means in Gtk+ 3.4 (which is the default of ubuntu 12.04 if I recall correctly).

So you either work around it or you go the thorny way of upgrading to Gtk+ 3.6 - which I - with all respect - do strongly disrecommend - especially since Unity needs various patches being incorporated into Gtk+ to work at all.


I just checked in gtk+-3.10.x the python bindings are fine and include get_child_at(..).

This question contains an answer that in fact this is a bug in the python bindings of gtk+ 3.4.

Solutions: Backport the git commit that fixes this (should be very tiny git commit) recompile/create deb package (significant knowledge required).

An alternate route would be to locally fix the binding specification and recreate the python introspection bindings locally - not sure if that is possible though - never did that.

Community
  • 1
  • 1
drahnr
  • 6,782
  • 5
  • 48
  • 75
  • What would i do for a work around? Using Table instead of Grid? But could i simply download gtk+3.6 from the repository without updating gtk+3.4? Unity would run fine with gtk+3.4 and my program too with gtk+3.6 – FrancescoN Apr 10 '14 at 21:38
  • OH WAIT: i just get a warning for *"input-purpose"* property, and as a warning actually i don't care of it. But my program fails for **'Grid' object has no attribute 'get_child_at'**: BUT ***this attribute is available from gtk+3.2***. And Ubuntu 12.04 comes with gtk+3.4, where is the problem? – FrancescoN Apr 10 '14 at 23:19
  • 1
    Can you show some code and xml from your glade file? Unfortunatly my crystal ball is currently broken. – drahnr Apr 10 '14 at 23:39
  • It is availiable in `C`, so it _should_ be availiable in python too, but this seems like a bug as @ptomato pointed out: http://stackoverflow.com/questions/12541328/python3-how-can-i-find-out-what-version-of-gtk-i-am-using – drahnr Apr 10 '14 at 23:46
  • I just checked in gtk+-3.10.x the python bindings are fixed (i.e. there is a gi wrapper for `get_child_at`). – drahnr Apr 10 '14 at 23:50
  • That looks fine. I think the issue is not within your code (see updated answer, previous comments). – drahnr Apr 10 '14 at 23:56
  • mmh if the python binding are fixed it should work.. anyway i just show the window containing the grid, i really don't know how to fix this – FrancescoN Apr 11 '14 at 00:00
  • Do you call `get_child_at()` explicitly? Anything internal to `Gtk+ 3.x` should call the `C` version. – drahnr Apr 11 '14 at 00:02
  • yes, see the edit: for now i go to sleep, it's 3 a.m. here, thank you very much for the help, tomorrow i'll read *"Python3: How can I find out .."* – FrancescoN Apr 11 '14 at 00:49
  • So there is nothing to do and it is a bug.. and Table object doesn't have this/similar method ("child_get" is different), time for another round of search and workaround, boring API – FrancescoN Apr 11 '14 at 09:55
  • No not really, you could grab the source, and (without compiling the actual source) recreate the introspection files (with the modifications needed so the get_foo is mapped too) (but this will limit it to only work on your local machine!). See here for a kickstart http://helgo.net/simon/introspection-tutorial/steptwo.xhtml Python has also the ability to call native C functions so that might work too. But I am not experienced in either. So.. good – drahnr Apr 11 '14 at 09:59