[pygtk] checkboxes untoggled
anusha k
anuhacks at gmail.com
Wed Oct 7 08:49:03 WST 2009
hello all,
i created a combobox with checkboxes.but i am not able to toggle
them.Actually i want to create multiselect combobox but landed up in this
issue.Is it possible to implement anyone of this.Thanks in advance
import gtk,gobject
class combo:
def __init__(self):
self.window = gtk.Window()
self.tax_list =
gtk.ListStore(gobject.TYPE_BOOLEAN,gobject.TYPE_STRING)
self.combobox_tax = gtk.ComboBox(self.tax_list)
renderer = gtk.CellRendererToggle()
renderer.set_property('activatable',True)
renderer.connect('toggled', self.toggled_callback, self.tax_list)
self.combobox_tax.pack_start(renderer, True)
self.combobox_tax.add_attribute(renderer, 'active', 0)
renderer = gtk.CellRendererText()
self.combobox_tax.pack_start(renderer, True)
self.combobox_tax.add_attribute(renderer, 'text', 1)
self.tax_list.append([False,'anusha'])
self.tax_list.append([False,'sha'])
self.tax_list.append([False,'anu'])
self.window.add(self.combobox_tax)
self.window.show_all()
def toggled_callback(cell, path, model=None):
iter = self.tax_list.get_iter(path)
self.tax_list.set_value(iter, 0, not cell.get_active())
if __name__ == '__main__':
c=combo()
gtk.main()
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://www.daa.com.au/pipermail/pygtk/attachments/20091007/3fe68d99/attachment.htm
More information about the pygtk
mailing list