[issue30200] tkinter ListboxSelect
Louie Lu
report at bugs.python.org
Sat Apr 29 03:43:56 EDT 2017
Louie Lu added the comment:
This behavior is as same as on my Linux Python 2.7.13:
(<Tkinter.Listbox instance at 0x7f4b2b0c08c0>, (2,)) # Select Font
(<Tkinter.Listbox instance at 0x7f4b29caf248>, (3,)) # Select Style
(<Tkinter.Listbox instance at 0x7f4b2b0c08c0>, ()) # Deselect Font
And also, you don't need a try expect to handle this situation. You can see that when de-select the listbox, curselection() will return an empty tuple, you only need an if statement to handle this:
def get_style(event):
lb_sty_cur = event.widget.curselection()
if lb_sty_cur:
lb_sty_get = listbox_style.get(lb_sty_cur)
self.style.set(lb_sty_get)
return
----------
_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue30200>
_______________________________________
More information about the Python-bugs-list
mailing list