tkinter Treeview disable cursor response
by RockDoctor from LinuxQuestions.org on (#5FXQG)
I've got a little program that draws diagrams based on the selection in a treeview. Selection is only done with the mouse. I use the left/right arrow keys to do horizontal translations, and would like to use the up/down arrows to do vertical translations without moving the selection bar in the treeview. I thought something likeCode: self.bind('<Key>', self.do_press)
# --------
def do_press(self, event):
""" The idea is to effectively ignore keyboard Up/Down """
passwould do the trick, but the treeview still responds to the up and down arrows.
I have a working kludge that involves hidden first and last rows in the treeview and making do_press() respond by moving up, then down (or vice-versa) to get back to its original position. Definitely not elegant. Is there a better way?
Attached Thumbnails


# --------
def do_press(self, event):
""" The idea is to effectively ignore keyboard Up/Down """
passwould do the trick, but the treeview still responds to the up and down arrows.
I have a working kludge that involves hidden first and last rows in the treeview and making do_press() respond by moving up, then down (or vice-versa) to get back to its original position. Definitely not elegant. Is there a better way?
Attached Thumbnails