473,397 Members | 1,969 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,397 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 1781
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 thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
by: j_mckitrick | last post by:
Hi all. Here is a tiny container for one of each combo box, along with the glade file. Just 2 widgets, so hopefully not too large. How the heck do I get the selection from the ComboBox, as...
5
by: Egbert Bouwman | last post by:
As a newby to PyGTK I already have produced some gui's I like, but I have difficulties in finding out what method or other instrument I need for doing various things. I have not yet found the...
0
by: Johan | last post by:
Hello! I'm trying to figure out how to use PYGTK to implement a rudimentary UI: I want to have an Image as the background, and then be able to put buttons (eventually icons, but buttons for...
5
by: Viktor | last post by:
Did anybody managed to "pack", a program that uses pygtk with pyexe? The best result I got was: Pango-ERROR **: file shape.c: line 75 (pango_shape): assertion faled: (glyphs->num_glyphs > 0)...
1
by: krishnakant Mane | last post by:
hello, I will be writing some code in PyGTK to run on linux. but I want to know if there are any installers or distutils available for PyGTK on windows? I have heard that installing gimp or even...
2
by: Laharl | last post by:
I'm working in pyGTK (completely new to it) and I need to display a tic-tac-toe board. It doesn't have to keep track of the game state, just place Xs and Os on click. Unfortunately, I can't get all 9...
0
by: Andrew Lapidas | last post by:
Hi All: I am currently having a problem updating a GUI. I am using PyGTK and Glade to design an interface for a project. This interface contains no buttons, just images, labels, and a...
0
by: Michael Palmer | last post by:
On Sep 16, 12:30 pm, binaryjesus <coolman.gu...@gmail.comwrote: I haven't tried it myself, but I came across a blog post the other day that describes a way of building windows installers for...
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...

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.