Tkinter Listbox looses selection on Tab

Jørgen Hansen jorgenhansen at hotmail.com
Tue Jul 22 14:40:16 EDT 2003


Hi

I have a problem with a Listbox in Tkinter. When I tab through several
widgets with the tab-key, the listbox looses its selection, even
though it has been selected with .selection_set. The example below
demonstrates this. Can anyone provide me with some help on this?

Regards
Jorgen 

Ps. I'm on a W2K machine with Python 2.2.2

----
from Tkinter import *

root = Tk()
colors = ['Yellow', 'Black', 'White', 'Green']

lb = Listbox(root)
for color in colors:
    lb.insert(END, color)

lb.selection_set(0)
lb.pack()
Entry(root).pack()
root.mainloop()
----




More information about the Python-list mailing list