[pygtk] Re: GNOME stock icons in glade - FIXED

Christopher Backhouse cjbackhouse at gmail.com
Tue Sep 25 06:42:20 WST 2007


doh - I read the FAQ:
Not only did I need to call gnome.init() but also import gnome.ui - it 
all works fine now.
Sorry for the stupid question.

Christopher Backhouse wrote:
> I want to use a GNOME stock icon in my application that uses glade.
> The problem I have is that GNOME icons display fine in glade, but don't 
> show up when I load the glade file in python.
> 
> Google vaguely hinted (e.g. 
> http://faq.pygtk.org/index.py?req=show&file=faq09.003.htp) that I 
> somehow have to enable GNOME support. I remember older versions of glade 
> had the choice between gtk and gnome projects - that no longer seems to 
> exist in glade 3. I also tried calling gnome.init() in my python code 
> with no success.
> 
> The test program below (and attached) ought to display (in my icon theme 
> at least) a blue 'i' symbol, and a yellow star. The 'i' (gtk stock icon) 
> appears, but not the star (GNOME stock icon).
> 
> 
> 
> import gtk.glade
> 
> xml=gtk.glade.XML('gnomeiconstest.glade')
> xml.get_widget('win').connect('destroy',gtk.main_quit)
> 
> gtk.main()
> 
> 
> 
> <?xml version="1.0" encoding="UTF-8" standalone="no"?>
> <!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
> <glade-interface>
>   <widget class="GtkWindow" id="win">
>     <property name="width_request">100</property>
>     <property name="height_request">100</property>
>     <property name="visible">True</property>
>     <child>
>       <widget class="GtkHBox" id="hbox">
>         <property name="visible">True</property>
>         <child>
>           <widget class="GtkImage" id="gtkimage">
>             <property name="visible">True</property>
>             <property name="stock">gtk-about</property>
>           </widget>
>         </child>
>         <child>
>           <widget class="GtkImage" id="gnomeimage">
>             <property name="visible">True</property>
>             <property name="stock">gnome-stock-about</property>
>           </widget>
>         </child>
>       </widget>
>     </child>
>   </widget>
> </glade-interface>
> 


More information about the pygtk mailing list