Article 5FXQG tkinter Treeview disable cursor response

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 Thumbnailsattachment.php?attachmentid=35954&stc=1& latest?d=yIl2AUoC8zA latest?i=muNvHVEENr0:L8yWZO2J5sk:F7zBnMy latest?i=muNvHVEENr0:L8yWZO2J5sk:V_sGLiP latest?d=qj6IDK7rITs latest?i=muNvHVEENr0:L8yWZO2J5sk:gIN9vFwmuNvHVEENr0
External Content
Source RSS or Atom Feed
Feed Location https://feeds.feedburner.com/linuxquestions/latest
Feed Title LinuxQuestions.org
Feed Link https://www.linuxquestions.org/questions/
Reply 0 comments