Use "space" for PageDown in TextView
- From: Dov Grobgeld <dov grobgeld gmail com>
- To: Gnome List <gtk-list gnome org>
- Subject: Use "space" for PageDown in TextView
- Date: Thu, 18 Feb 2010 09:46:25 +0200
I'm trying to write a simple text reading application with the TextView widget. As I am only doing reading I would like to rebind the space bar to do page down. But I can't get it to work. Here's what I did (in Python):
# The following code is taken from
# and shows how to override key bindings.
def override (key, modifier, movement, step, select):
gtk.binding_entry_remove (gtk.TextView, key, modifier)
gtk.binding_entry_add_signal (gtk.TextView, key, modifier,
def override_key_bindings (select):
"""Override the default TextView keybinding to either always force
the extension the selection, or not"""
override (SPACE, 0, gtk.MOVEMENT_PAGES, 1, select)
override (BACKSPACE, 0, gtk.MOVEMENT_PAGES, -1, select)
tv = gtk.TextView()
What seems to happen is that in addition to my SPACE binding another binding for space is being triggered. If I e.g. select part of the text in the widget and press SPACE, then the widget is scrolled such that the selected text is visible. So the question seems to be why does binding_entry_remove() not clear the default binding for space?
] [Thread Prev