473,550 Members | 2,896 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

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.GtkToggleBu tton()
button.connect( "clicked", do_my_thing)
button.show()
pix,mask = gtk.create_pixm ap_from_xpm(win dow,None,'nice. xpm')
pixmap = gtk.GtkPixmap(p ix,mask)
pixmap.show()
button.add(pixm ap)
Can someone tell me how to make it work?

Thanks,
Fulko
--
Fulko van Westrenen
fw**@lina.dto.t udelft.nl
Jul 18 '05 #1
2 1791
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.GtkToggleBu tton()
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******@nowhe re.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
2589
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 opposed to the ComboEntryBox? I'm pulling my hair out over this one! jonathon
5
1595
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 tutorial or otherwise that explains concepts like setting (relative) sizes, setting or manipulating focus, setting colors, etc. Also when I think I...
0
1345
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 now) The PyGTK FAQ (pygtk.org) has some suggestions, but they have failed to clear up the issue. Using their suggestions as a starting point, I've...
5
7913
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) aborting... I'm using python2.4, pygtk-2.6.1-1.win32-py2.4, gtk-win32-2.6.4-rc1. Thanks in advance.
1
1765
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 pygtk is next to impossible and is very tedious if at all one gets success. can any one share their experiences with installing and running pygtk...
2
1805
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 buttons to show. Currently, I'm trying to use 3 HButtonBoxes of 3 buttons each packed into an VBox. Unfortunately, I get a blank window when I run. ...
0
849
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 progress bar. The code for the project is small, and it basically does some things independent of the GUI in an infinite loop. I need the project code...
0
1774
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 pyGTK applications at http://unpythonic.blogspot.com/2007/07/pygtk-py2exe-and-inno-setup-for-single.html
0
7487
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
0
7758
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
0
7844
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 protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
0
6098
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, and deployment—without human intervention. Imagine an AI that can take a project description, break it down, write the code, debug it, and then...
1
5401
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 presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
0
3530
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The last exercise I practiced was to create a LAN-to-LAN VPN between two Pfsense firewalls, by using IPSEC protocols. I succeeded, with both firewalls in...
0
3514
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
1
1093
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
0
800
bsmnconsultancy
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

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.