I use Glade 3.6.3 and Python. I have a problem with the use of
gtk.glade.XML
I begin my program with :

#!/usr/bin/env python

import sys
import gtk
import gtk.glade

Then in the Tutoriel class, I open a method for the About-dialog :

  def on_about_menu_item_activate(self,data=None):
      about1 = gtk.glade.XML("tutoriel.glade","aboutdialog")
      about=about1.get_widget("aboutdialog")
      about.run()
      about.hide()

where "aboutdialog" is a node in the xml file "tutoriel.glade" as you
can see below:
        .....
      </child>
    </object>
  </child>
</object>
<object class="GtkAboutDialog" id="aboutdialog">
  <property name="border_width">5</property>
  <property name="type_hint">normal</property>
  <property name="has_separator">False</property>
  <property name="program_name">G2Sync</property>
  <property name="version">v 0.1</property>
  <property name="license" translatable="yes">GPL</property>
  <property name="authors">Ramses</property>
  <property name="translator_credits"
translatable="yes">Moim&#xEA;me</property>
  <child internal-child="vbox">
    <object class="GtkVBox" id="dialog-vbox1">
      <property name="visible">True</property>
      <property name="orientation">vertical</property>
      <property name="spacing">2</property>
      <child>
        <placeholder/>
      </child>
      <child internal-child="action_area">
        <object class="GtkHButtonBox" id="dialog-action_area1">
          <property name="visible">True</property>
          <property name="layout_style">end</property>
        </object>
        <packing>
          <property name="expand">False</property>
          <property name="pack_type">end</property>
          <property name="position">0</property>
        </packing>
      </child>
    </object>
  </child>
</object>
</interface>

When I click on the "about" menu, the method
"on_about_menu_item_activate" is well called but I got this messages:

(tuto-glade2.py:13425): libglade-WARNING **: Expected
<glade-interface>.  Got <interface>.

(tuto-glade2.py:13425): libglade-WARNING **: did not finish in
PARSER_FINISH state
Traceback (most recent call last):
File "tuto-glade2.py", line 18, in on_about_menu_item_activate
  about1 = gtk.glade.XML("tutoriel.glade","aboutdialog")
RuntimeError: could not create GladeXML object

It looks like if gtk.glade.XML works just with libglade. I use
GtkBuilder, so the tag in tutoriel.glade is natively <interface>.
Is it something not up to date with gtk.glade.XML ?
_______________________________________________
pygtk mailing list   pygtk@daa.com.au
http://www.daa.com.au/mailman/listinfo/pygtk
Read the PyGTK FAQ: http://faq.pygtk.org/

Reply via email to