Remove ttk Combobox Mousewheel Binding

Viewed 1437

I have a ttk Combobox I'd like to unbind from the mousewheel so that scrolling with the wheel while the Combobox is active doesn't change the value (instead it scrolls the frame).

I've tried unbind as well as binding to and empty function but neither works. See below:

import Tkinter as tk
import ttk


class app(tk.Tk):
    def __init__(self, *args, **kwargs):
        tk.Tk.__init__(self, *args, **kwargs)
        self.interior = tk.Frame(self)

        tkvar = tk.IntVar()
        combo = ttk.Combobox(self.interior,
                             textvariable = tkvar,
                             width = 10,
                             values =[1, 2, 3])
        combo.unbind("<MouseWheel>")
        combo.bind("<MouseWheel>", self.empty_scroll_command)
        combo.pack()
        self.interior.pack()


    def empty_scroll_command(self, event):
        return

sample = app()
sample.mainloop()

Any help would be greatly appreciated.

Thanks!

1 Answers
Related