Capture Right Click events in pygtk


If you pass in the event when you enter a callback, you can look at event.type to determine which button was pushed and process the action accordingly.

If you’re only interested in the right-click, say for a menu popup for example, check for event.button equal to three.

Make sure to check the event.type first for a button press as not all events will define an event.button.

Here’s an example of catching right clicks on a treeview:

In this case, connecting the broad ‘event’ enables my callback to use event without having to pass it in, however, most signals all you to specify any arguments you want.


Posted on July 27th, by admica in python.


Leave a Reply

Your email address will not be published. Required fields are marked *


*

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code class="" title="" data-url=""> <del datetime=""> <em> <i> <q cite=""> <strike> <strong> <pre class="" title="" data-url=""> <span class="" title="" data-url="">