[pygtk] Subclassing gtk.ToolItem
zsolt foldvari
zsolt.foldvari at gmail.com
Thu Apr 24 20:12:34 WST 2008
I'm trying to subclass gtk.ToolItem to include a custom widget into it.
Now, when I tried to override the gtk.ToolItem.set_tooltip() method
python crashes with:
python: Objects/stringobject.c:107: PyString_FromString: Assertion
`str != ((void *)0)' failed.
Any idea what am I doing wrong?
Cheers,
Zsolt
<code>
class ComboToolItem(gtk.ToolItem):
__gtype_name__ = "ComboToolItem"
def __init__(self):
gtk.ToolItem.__init__(self)
self.combobox = gtk.combo_box_entry_new_text()
self.combobox.show()
self.add(self.combobox)
def do_set_tooltip(self, tooltips, tip_text=None, tip_private=None):
gtk.ToolItem.set_tooltip(tooltips, tip_text, tip_private)
tooltips.set_tip(self.combobox, tip_text, tip_private)
class ComboToolAction(gtk.Action):
__gtype_name__ = "ComboToolAction"
def __init__(self, name, label, tooltip, stock_id):
gtk.Action.__init__(self, name, label, tooltip, stock_id)
ComboToolAction.set_tool_item_type(ComboToolItem)
</code>
More information about the pygtk
mailing list