471,351 Members | 1,540 Online
Bytes | Software Development & Data Engineering Community
Post +

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 471,351 software developers and data experts.

pyGTK, Buttons and Pixmaps problem


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)
button.show()
pix,mask = gtk.create_pixmap_from_xpm(window,None,'nice.xpm')
pixmap = gtk.GtkPixmap(pix,mask)
pixmap.show()
button.add(pixmap)
Can someone tell me how to make it work?

Thanks,
Fulko
--
Fulko van Westrenen
fw**@lina.dto.tudelft.nl
Jul 18 '05 #1
2 1695
In article <sl******************@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-do...tkiconset.html

Dave Cook
Jul 18 '05 #2
On Thu, 27 Nov 2003 19:21:57 GMT, David M. Cook <da******@nowhere.net> wrote:
In article <sl******************@lina.dto.tudelft.nl>, Fulko van Westrenen
wrote: [...]
For a toggle button, you want to handle the "toggle" signal.
OK
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-do...tkiconset.html
Dear Dave,
Thank you for your hint. I read this forward and back again, but I can't
figure how to apply this. Is there example-code somewhere that shows a
changing image when pushing the button?
Best,
Fulko

Dave Cook

--
Fulko van Westrenen
Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by j_mckitrick | last post: by
5 posts views Thread by Egbert Bouwman | last post: by
reply views Thread by Johan | last post: by
5 posts views Thread by Viktor | last post: by
1 post views Thread by krishnakant Mane | last post: by
2 posts views Thread by Laharl | last post: by
reply views Thread by Andrew Lapidas | last post: by
reply views Thread by Michael Palmer | last post: by
reply views Thread by XIAOLAOHU | last post: by

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.