| FAQ Index - Search - Recent Changes - Everything - Add entry |
5.19. How can I listen to events from the scroll wheel on my mouse?
To listen for events that your scroll wheel sends you need to connect to the signal 'scroll-event'. The event structure has a direction attribute which will be one of:
gtk.gdk.SCROLL_UP, gtk.gdk.SCROLL_DOWN, gtk.gdk.SCROLL_LEFT, gtk.gdk.SCROLL_RIGHTExample:
def on_button_scroll_event(button, event):
if event.direction == gtk.gdk.SCROLL_UP:
print "You scrolled up"
b = gtk.Button()
b.connect('scroll-event', on_button_scroll_event)
