selecting an item from listbox and using the name of the item later selecting an item from listbox and using the name of the item later tkinter tkinter

selecting an item from listbox and using the name of the item later


You have to use Bindings to do so,

For Ex:

listnotes.bind("<Return>", dosomething)   #to bind to your enterkey

and then the curselection method associated to the Listbox

def dosomething(event):    """    on enter, capture the value from the Listbox     and assign the value captured to value via the get method form the selected value    """    try:        selection = listnotes.curselection()        value = listnotes.get(selection[0])    except Exception as select:        print("Nothing selected")        pass