Reputation: 916
I was wondering whether it is possible to disable mouse control over a listbox in Tkinter. I want arrow keys navigation only. Is this possible?
Upvotes: 2
Views: 1731
Reputation: 385880
If you create a binding to an event, and in that binding you do return "break"
, you will prevent the default behavior from being performed. Thus, you simply need to create your own bindings for events you don't want the user to be able to use.
For example:
...
my_listbox.bind("<1>", self.no_op)
my_listbox.bind("<Double-1>", self.no_op)
...
def no_op(self, event):
return "break"
There may be a couple other bindings you need to disable, but that probably gets you 95% of the way there.
Upvotes: 2