listbox binding..what is the current selection?

Rex Macey xer0925 at gmail.com
Tue Mar 5 19:54:45 EST 2013


I have a listbox with two strings "Fixed" and "Random". It is bound by the following statement: 
lbLengthtype.bind('<ButtonRelease-1>',set_lengthtype)

Here's the beginning of the set_lengthtype code:

def set_lengthtype(event=None): 
   s=lbLengthtype.get(tk.ACTIVE)
   print(s)  
   .....

The print(s) statement is for debugging.  If 'Random' was selected and the user clicks 'Fixed',  then Random will print.  I would like to know what the user just selected, not what was selected before the user clicked.  How can I determine the current selection? Thanks.  





More information about the Python-list mailing list