[pygtk] Default values not respected with Glade and PyGTK

Benjamin Esham bdesham at gmail.com
Sat Aug 30 04:58:46 WST 2008


(I originally posted this to the glade-users list, but didn't get a
response there... I thought I might have better luck here.)

Hello all,

I am using Glade and PyGTK under Mac OS X.  With Fink, I've installed GTK+
2.12.11, PyGTK 2.12.1, and Glade 3.4.5 (the latest versions available
through Fink).

I've been having some problems with SpinButtons not respecting the default
values given them in Glade.  Running the included Python script with the
included Glade file displays a window with a single SpinButton.  According
to Glade, the default value for the button should be 2, but the actual
value shown when the program runs is 0.  Is this a bug, or am I doing
something wrong with Glade and/or PyGTK?

Thanks in advance for any help with this issue!

*** SpinButton_test.py:

import pygtk
pygtk.require("2.0")
import gtk, pango, gtk.glade

glade_tree = gtk.glade.XML("SpinButton_test.glade")

gtk.main()

*** SpinButton_test.glade:

<?xml version="1.0" encoding="UTF-8" standalone="no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.4.5 on Tue Aug 12 20:43:35 2008 -->
<glade-interface>
  <widget class="GtkWindow" id="window">
    <property name="visible">True</property>
    <child>
      <widget class="GtkSpinButton" id="u_button">
        <property name="visible">True</property>
        <property name="can_focus">True</property>
        <!-- the next (long) line was not originally wrapped -->
        <property name="events">GDK_POINTER_MOTION_MASK |
            GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK |
            GDK_BUTTON_RELEASE_MASK</property>
        <property name="adjustment">2 0 16 1 10 10</property>
        <property name="snap_to_ticks">True</property>
        <property name="numeric">True</property>
      </widget>
    </child>
  </widget>
</glade-interface>

-- 
Benjamin D. Esham
E-mail/Jabber: bdesham at gmail.com | AIM bdesham128 | PGP D676BB9A
"White shores and beyond.  A far green country, under a swift sunrise."
"Well...  That isn't so bad."
"No...  No it isn't."               — Gandalf and Pippin in RotK



More information about the pygtk mailing list