Lets say I have window with Listbox. After inserting items to my listbox I want to move selection with down arrow key, after pressing it i see that selection moved to last item on the list.
Why pressing down arrow selects last element on the list and not second one? What needs to be done to restore proper order of selection?
Example app
from tkinter import *
root = Tk()
root.bind('<Escape>', lambda e: root.quit())
listbox = Listbox(root)
listbox.insert(END, *[i for i in range(20)])
listbox.pack()
listbox.focus()
listbox.selection_set(0)
# now, changing selection with down arrow key goes to last element on the list not second one
root.mainloop()