Tkinter tab focus traversal causes listbox selection to clear, ie, lose the selected item

Eric Brunel see.signature at no.spam
Thu Aug 14 05:09:16 EDT 2008


On Thu, 14 Aug 2008 04:49:51 +0200, Gerardo ARnaez <garnaez at gmail.com>  
wrote:

> Hi.
> I am writing a program to help determine coumadin regimens
> to look at the code: http://sourceforge.net/projects/coumadinregimen/
>
> The issue is that I have a variable that I want the use to select if
> they don't like the default.
> I have made this as a listbox widget
>
> The rest of the gui is just entry widgets
>
> What I noticed is that when I tab to through the entry  widgets, I
> lose the listbox selection: the item selected, gets unselected.
>
> Not sure what is happening,hope I have explained it.

Usual tk/Tkinter pitfall: the selected item in a list box is by default  
considered as a text selection. Since you can only have one text selected  
at a time, selecting anything anywhere will unselect the item in the list.  
To avoid this, use the exportselection=0 option when you're creating your  
Listbox.

> Thanks,
> G

HTH
-- 
python -c "print ''.join([chr(154 - ord(c)) for c in  
'U(17zX(%,5.zmz5(17l8(%,5.Z*(93-965$l7+-'])"



More information about the Python-list mailing list