[pygtk] ImageMenuItem with disappearing image

Jeffrey Barish jeff_barish at earthlink.net
Tue Mar 31 11:39:28 WST 2009


Jeffrey Barish wrote:

> I have an ImageMenuItem with check mark (gtk.STOCK_APPLY) as the image.  I
> want the visibility of the image to toggle everytime I select the item.  I
> am doing that now by controlling the visibility property of the image
> (menuitem.props.image.props.visible).  That technique works, but the space
> occupied by the image when it is visible is still present when it is not.
> I haven't been able to figure out a way to make that space vanish.  I
> suspect that I have to resize either the ImageMenuItem or the parent Menu.
> I have played with the set_resize_mode and resize_children methods of
> gtk.Container without success.  The only technique I have found that works
> is to set the image to None to make it disappear and then recreate it to
> make it reappear.  Surely there is a better way.  Suggestions?

Ah, gtk.CheckMenuItem.
-- 
Jeffrey Barish



More information about the pygtk mailing list