473,781 Members | 2,335 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

PyGTK Notebook button_press_ev ent connection

Hi all!

I have an application that uses a gtk.Notebook to show the content of a
GUI. Each page of it has a gtk.Label with a text that explains the
content. Each page is added to the notebook with the method
append_page(chi ld, tab_label=None) , passing a gtk.Label instance as
tab_label variable.

Now I'd like to connect to the button_press_ev ent of the gtk.Label a
function call. I've done something like this:

<code>

notebook = gtk.Notebook()
....
child = gtk.Frame()
....
label = gtk.Label('Any text')
label.connect(' button_press_ev ent', a_function)
....
notebook.append _page(child, label)

</code>

But the button_press_ev ent event is not intercepted (nothing happens
when I click on the tab label).

Any idea to solve this question?

Thanks

Luigi

Jan 24 '06 #1
1 3104
> <code>

notebook = gtk.Notebook()
...
child = gtk.Frame()
...
label = gtk.Label('Any text')
label.connect(' button_press_ev ent', a_function)
...
notebook.append _page(child, label)

</code>

But the button_press_ev ent event is not intercepted (nothing happens
when I click on the tab label).


A gtk.Label does not have a gdk window (as in the windowing system of gtk+),
so it cannot listen to events. A workaround is to put it in an eventbox:

eventbox = gtk.EventBox()
eventbox.set_ev ents(gtk.gdk.BU TTON_PRESS_MASK )
eventbox.connec t('button-press-event', callback)

label = gtk.Label()
eventbox.add(la bel)

notebook.append _page(..., eventbox)

Perhaps you should subscribe to the PyGTK mailing list[1] though, where this
kind of question is more appropriately asked

[1]: http://www.daa.com.au/mailman/listinfo/pygtk

Johan Dahlin

Jan 24 '06 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

4
2480
by: F. GEIGER | last post by:
Hi again, I'd like to rename a page of a notebook. Deleting the page and adding a new one is not really an option, because the page is filled with other controls already. So I looked into Pmw.Notebook. There are quite a few lists and dicts which were to be changed and I wasn't successful in the first try. However, if nobody has ever done this, I'd have to rebuild the whole page after deleting/adding. I really hope there's an other way...
4
2602
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
6
2041
by: Mark Mitchell | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 I have a program written in python that tells me it requires PyGTK, so I DLed, ./configure, make, make install and the process seems to go ok. Some errors but the process finishes so I assumed they weren't fatal errors. So now I attempt to run my python program and I get; $ gccp.py Traceback (most recent call last):
0
1364
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 arrived at the below. However, it fails in that I can't seem to
7
6643
by: Domenique.Tilleuil | last post by:
hello, Is there an event simular to the java event onMouseOver ? I want to get the coordinates of the mouse pointer when it is over an image ( GTKImage widget) I've tried using the EventBox with the motion_notify but that only seems to work when the mouse is pressed ?
25
4283
by: TPJ | last post by:
GUI's etc: PyGtk on Windows "(...) So if someone develops mainly for X and just wants to make sure that it is not impossible to run on Windows, you can use PyGTK. (...)", July 2nd, 1999 pyGTK on Windows "(...) > can i use pyGTK under > Windows???
8
16722
by: JyotiC | last post by:
I want to make a stand alone gui. Whose work is to get the diff options from user and run a shell script based on them. I wanna know which one is better to use Tkinter or PyGTK, in terms of efficiency and functionality. I hv read about Tkinter, but it takes too much time to load, is there a way to make it faster. Is all gui take more time to load, this is the first time i am making a gui.
1
1778
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 on windos? any links for downloading proper packages will be highly appreciated. regards,...
0
1785
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
9474
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 synchronization. With a Microsoft account, language settings sync across devices. To prevent any complications,...
0
10139
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that captivates audiences and drives business growth. The Art of Business Website Design Your website is...
1
10075
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 Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For most users, this new feature is actually very convenient. If you want to control the update process,...
0
9931
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 choice of these technologies. I'm particularly interested in Zigbee because I've heard it does some...
0
8961
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 launch it, all on its own.... Now, this would greatly impact the work of software developers. The idea...
0
5373
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 the same network. But I'm wondering if it's possible to do the same thing, with 2 Pfsense firewalls...
1
4037
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
2
3632
muto222
by: muto222 | last post by:
How can i add a mobile payment intergratation into php mysql website.
3
2869
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 effective websites that not only look great but also perform exceptionally well. In this comprehensive...

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.