Skip to content

Instantly share code, notes, and snippets.

@Furao
Created September 1, 2011 21:35
Show Gist options
  • Star 1 You must be signed in to star a gist
  • Fork 1 You must be signed in to fork a gist
  • Save Furao/1187347 to your computer and use it in GitHub Desktop.
Save Furao/1187347 to your computer and use it in GitHub Desktop.
Prevent a Combobox from scrolling in PyGTK
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)
@Furao
Copy link
Author

Furao commented Sep 1, 2011

Useful if you have a lot of comboboxes within a scrolling window.

@serdarsen
Copy link

Thank you

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment