I'm trying to make a Gtk with Combobox with checkboxes in it. But "my" checkboxes are inactive, though I tried in many ways - I just cannot click them. Here is a fragment from my program
self.listst= Gtk.ListStore(str)
combost= Gtk.ComboBox.new_with_model(self.listst)
self.rend = Gtk.CellRendererToggle()
self.rend.connect("toggled", self.cell_toggled)
combost.pack_start(self.rend, False)
for stac in ["first option","second option"]:
self.listst.append([stac])
cellrendst = Gtk.CellRendererText()
combost.pack_start(cellrendst, True)
combost.add_attribute(cellrendst, "text", 0)
self.buttbox.pack_start(combost,True, True,0)
def cell_toggled(rend, path):
self.rend[path][1] = not self.rend[path][1]
I presume I must pack this CellRendererToggle() in something and set active state of cellrenderertoggle but I don't know how to join it to combobox then.
Aucun commentaire:
Enregistrer un commentaire