Skip to content

Instantly share code, notes, and snippets.

@serdarsen
Forked from Furao/combo.py
Created May 22, 2018 13:42
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save serdarsen/d52e4c87b3e6043732d45aaa7392e951 to your computer and use it in GitHub Desktop.
Save serdarsen/d52e4c87b3e6043732d45aaa7392e951 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)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment