Created
September 1, 2011 21:35
-
-
Save Furao/1187347 to your computer and use it in GitHub Desktop.
Prevent a Combobox from scrolling in PyGTK
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def combo_scrolling(combobox, event): | |
"""Prevent the comboboxes from scrolling.""" | |
combobox.emit_stop_by_name("scroll-event") | |
values = ['item 1', 'item 2', 'item 3'] | |
combo = gtk.combo_box_new_text() | |
# Fill with part type options | |
for val in values: | |
combo.append_text(val) | |
# Set default selection to first field | |
combo.set_active(0) | |
combo.connect("scroll-event", combo_scrolling) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Useful if you have a lot of comboboxes within a scrolling window.