[pygtk] Combobox error? duplicated columns
Edward Stow
ed.stow at gmail.com
Thu Feb 14 09:14:26 WST 2008
Hi
I'm not sure is this is an error -- but when I attach a ListModel and
and CellRenderer to a gtk.ComboBox I end up with duplicate columns in
the list box. Attached is a small screenshot.
This only occurs if I have first opened the combobox list editor in
glade and then saved.
Glade inserts an empty items property in the xml:
<property name=3D"items" translatable=3D"yes"></property>
Removing this element fixes the problem. The code below replicates the pro=
blem.
Is this a bug and should be reported on bu
Relevent versions numbers are:
ii python 2.5.1-0ubuntu3
ii python-glade2 2.10.4-0ubuntu3
ii python-gtk2 2.10.4-0ubuntu3
ii glade-3 3.2.0-0ubuntu1
ii libglade2-0 2.6.0-3
-----code follows ---
#!/usr/bin/env python2.5
import pygtk
import gtk
import gtk.glade
glade_buffer =3D """<?xml version=3D"1.0" encoding=3D"UTF-8" standalone=3D"=
no"?>
<!DOCTYPE glade-interface SYSTEM "glade-2.0.dtd">
<!--Generated with glade3 3.2.0 on Thu Feb 14 10:01:52 2008 by
edward at edward-desktop-->
<glade-interface>
<widget class=3D"GtkWindow" id=3D"window1">
<property name=3D"events">GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class=3D"GtkVBox" id=3D"vbox1">
<property name=3D"visible">True</property>
<property name=3D"events">GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK</property>
<child>
<widget class=3D"GtkComboBox" id=3D"combobox1">
<property name=3D"visible">True</property>
<property name=3D"events">GDK_POINTER_MOTION_MASK |
GDK_POINTER_MOTION_HINT_MASK | GDK_BUTTON_PRESS_MASK |
GDK_BUTTON_RELEASE_MASK</property>
<property name=3D"wrap_width">1</property>
<!-- VVVVV Note the items property -->
<property name=3D"items" translatable=3D"yes"></property>
</widget>
</child>
</widget>
</child>
</widget>
</glade-interface>
"""
=
if __name__ =3D=3D "__main__":
xml =3D gtk.glade.xml_new_from_buffer(glade_buffer, len(glade_buffer))
combobox =3D xml.get_widget('combobox1')
=
liststore =3D gtk.ListStore(str)
liststore.append(['first'])
liststore.append(['second'])
=
combobox.set_model(liststore)
=
cell =3D gtk.CellRendererText()
combobox.pack_start(cell, True)
combobox.set_attributes(cell, text=3D0)
w =3D xml.get_widget('window1')
w.show_all()
gtk.main()
-- =
Edward Stow
-------------- next part --------------
A non-text attachment was scrubbed...
Name: duplicate_columns.png
Type: image/png
Size: 6249 bytes
Desc: not available
Url : http://www.daa.com.au/pipermail/pygtk/attachments/20080214/c1e24d83/d=
uplicate_columns.png
More information about the pygtk
mailing list