[pygtk] subclassing gtk.ToolItem

Christian Becke christianbecke at web.de
Mon Dec 10 01:18:57 WST 2007


Hi all,

I'm trying to create a custom gtk.ToolItem containing a gtk.CheckBox and
use it with gtk.UIManager.
In the pygtk reference [1] I found some hints on how to do this,
however, I couldn't get it to work.

I can manually insert my custom toolitem into a toolbar, but if I try to
use it with the uimanager, it isn't displayed in the toolbar at all - in
the menubar, however, the according menu entry is set up allright. But
if I toggle the menu entry, I get the following error message:
"GtkWarning: Don't know how to toggle `CheckToolButton' widgets".

You can find the sources of the custom ToolItem, and my test-cases
manually inserting the item into a toolbar or using the uimanager here [2].

Tried with (py)gtk-2.12.0 on Ubuntu Gutsy and gtk-2.12.1/pygtk-2.12.0 on 
Gentoo, both give same results.

What am I doing wrong? Is there another way of getting a gtk.CheckButton
(or something similar) into a toolbar using gtk.UIManager? How can I 
make my widget toggleable when used with uimanager?


Thanks for your help,

Christian


[1] 
http://pygtk.org/docs/pygtk/class-gtkaction.html#method-gtkaction--set-tool-item-type
[2] 
http://userpage.chemie.fu-berlin.de/~chrbecke/downloads/subclassing_toolitem.tar.gz


More information about the pygtk mailing list