pyGTK, Buttons and Pixmaps problem

David M. Cook davecook at nowhere.net
Thu Nov 27 20:21:57 CET 2003


In article <slrnbscfk0.c1h.fulko at lina.dto.tudelft.nl>, Fulko van Westrenen
wrote:

> Hello,
> 
> I use pyGTK in a program with ToggleButton and Pixmap.
> The problem I try top solve is changing the pixmap for the
> two states of the button. Can it be done? (should be possible),
> and someone provide me with working code?
> 
> The code I use now is (python-2.2, gtk-1.2):
> 
> button = gtk.GtkToggleButton()
> button.connect("clicked", do_my_thing)

For a toggle button, you want to handle the "toggle" signal.  Also, for
getting the icon to change between states I think you want to look at the
IconSet and IconSource APIs:

http://www.gnome.org/~james/pygtk-docs/class-gtkiconset.html

Dave Cook




More information about the Python-list mailing list