Glade and deprecated gtk properties

家住魔仙堡 提交于 2019-12-25 04:27:33

问题


i've been trying to run a software where i've built the UI by Glade. Glade then transform the UI in an XML file, and then in Python i just load that file.

But i've a problem with (maybe) deprecated properties of gtk objects. This is what the interpreter says:

 Unknown property: GtkScrolledWindow.min-content-width
  self.__builder.add_from_file('UI2.glade')
/home/jimmy/Documenti/linguaggi_dinamici/progetto/collega_GUI.py:37: GtkWarning: Unknown property: GtkScrolledWindow.min-content-height
  self.__builder.add_from_file('UI2.glade')
/home/jimmy/Documenti/linguaggi_dinamici/progetto/collega_GUI.py:37: GtkWarning: Unknown property: GtkBox.margin-left
  self.__builder.add_from_file('UI2.glade')
/home/jimmy/Documenti/linguaggi_dinamici/progetto/collega_GUI.py:37: GtkWarning: Unknown property: GtkBox.margin-right
  self.__builder.add_from_file('UI2.glade')
/home/jimmy/Documenti/linguaggi_dinamici/progetto/collega_GUI.py:37: GtkWarning: Unknown property: GtkBox.margin-bottom
  self.__builder.add_from_file('UI2.glade')

(main.py:4490): GLib-GObject-ERROR **: cannot create instance of abstract (non-instantiatable) type 'GtkBox'
Trace/breakpoint trap (core dumped)

I could try to remove GtkBox.margin-left-right-bottom, but i need the property GtkScrolledWindow.min-content-height.

The strange thing is that GtkScrolledWindow.min-content-width has been working corretcly, because i can't see any WARNING about that.

EDIT :: informations about Gtk and Glade versions currently running

Glade: 3.14.2

collega_GUI.py

try:  
    import pygtk  
    pygtk.require("2.0")  
except:  
    pass  

try:  
    import gtk  
    import gtk.glade  
except:  
    print("GTK Not Availible")
    sys.exit(1)

I ran this command to retrieve the version of gtk:

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

and i got

2.24.20-1ubuntu1

回答1:


The glade-3.8.x series is the last version supporting Gtk+2. glade > 3.8.x targets Gtk+3. Ubuntu provides the glade-gtk2 package which packages the 3.8.x version, whereas the glade package packages the latest, Gtk+3 only version.

So if you are targeting Gtk+2, you need to install glade-gtk2 and use that version of glade.

Note: similarly on Fedora, the glade package ships the Gtk+3 version, whereas the glade3 (not really an optimal name) ships the Gtk+2 version.



来源:https://stackoverflow.com/questions/21626824/glade-and-deprecated-gtk-properties

易学教程内所有资源均来自网络或用户发布的内容,如有违反法律规定的内容欢迎反馈
该文章没有解决你所遇到的问题?点击提问,说说你的问题,让更多的人一起探讨吧!