[pygtk] Cell renderer spins out of control

Tobias Weber towb at celvina.de
Tue Sep 29 23:18:28 WST 2009


Hi,
my TreeView generates values dynamically, including the limits for a  
numerical column:

def spin_func(cell, editable, path, model):
     a = editable.get_adjustment()
     t = model.get(path, schema.maximum)
     a.set_property('upper', t)

a = gtk.Adjustment(0, 0, 9999, 1)
r = gtk.CellRendererSpin()
r.set_property('adjustment', a)
r.set_property('editable', True)
r.connect('editing-started', spin_func, self.model)

c = gtk.TreeViewColumn('Episode', r)
c.set_cell_data_func(r, text_data_func, schema.current)

This works where my first attempt using a.set_upper instead of  
a.set_property raised AttributeError. Is the documentation wrong?

Unfortunately after the first few edits, usually right after setting  
an upper of 10000, the editable breaks until I restart my program. The  
spinner behaves as if someone was sitting on the keyboard: cursor  
flickering, numbers dancing.


More information about the pygtk mailing list