I have an application that has a number of entry widgets and a treeview widget. What I'm trying to do is have a user select a row (child) in the treeview, have certain pieces of data extracted from the child and displayed in differing entry widgets. The user can change or leave whatever data is necessary, hitting 'Return' on each entry widget until the last. Hitting 'Return' on the last entry widget should give focus back to the Treeview, specifically the next child in the list (the row/child immediately below what was originally clicked.
def display_chosen(self, event):#Called when user clicks row/child in 'dirdisplay' Treeview widget
clickedfile = self.dirdisplay.focus()#Get child (row) id of click
self.nextID = self.dirdisplay.next(clickedfile)#Get next child, place in class-wide accessible variable
self.enableentries()#Enable entry boxes so data extraction to entry widgets work
#Do whatever to send data to entry widgets
def enableentries(self):#Sets three entry widgets a, b, c to state normal.
try:
self.a.config(state=NORMAL)
self.b.config(state=NORMAL)
self.c.config(state=NORMAL)
except AttributeError:
pass
def a_to_b(self, event):#While in entry 'a', hitting 'Return' calls this and sets focus to next entry widget, 'b'
#Do whatever with data in a
self.b.focus_set()
def b_to_c(self, event):#While in entry 'b', hitting 'Return' calls this and sets focus to next entry widget, 'c'
#Do whatever with data in b
self.c.focus_set()
def c_to_nex(self, event):#Hitting 'Return' on 'c' calls this, setting focus back to 'dirdisplay' treeview, giving focus to child immediately below what was originally clicked.
#Do whatever with data in c
print('Focus acknowledged')
print(self.nextID)#Feedback to show me the nextID actually exists when I hit 'Return'
self.dirdisplay.focus_set()
self.dirdisplay.focus(self.nextID)
So, this along with the rest of my code (huge, I think I'm showing everything important here, please let me know if more is needed) works in part. a_to_b, b_to_c work correctly. When c_to_nex is called (I know its called when I hit return because of the feedback prints) I know nextID is correct as it does print the correct child ID, but nothing else happens. I know treeview has focus because hitting up or down on the keyboard traverses the rows. I also know that the row nextID describes is 'sort of' in focus because when I hit down, the third row (below the nextID row) is highlighted.
This 'sort of' focus on the nextID row doesnt help me, since I need the row to be selected as if the user clicked on it his or herself.
describes a similar question asked a while back, unfortunately, none of those answers helped. I know I'm close, and I know im probably using 'self.dirdisplay.focus(self.nextID)' either incorrectly or with missing options.
Thanks!