I have constructed a listbox using tkinter Now I want the user to click on an item in the listbox that creates a variable with the selection.
listbox.bind('<ButtonRelease-1>', get_list)
def get_list(event):
    index = listbox.curselection()[0]
    seltext = listbox.get(index)
    print(seltext)
This properly prints out the selection. However, I am unable to get the "seltext" out of the function and able to use it later in the code. Someone recommended the get_list(event) however I don't know where event came from. Appreciate the help
EDIT:
   for f in filename:
                with open(f) as file_selection:
                    for line in file_selection:
                        Man_list = (line.split(',')[1])
                        listbox.insert(END, Man_list)
                file_selection.close()
        def get_list(event):
            global seltext
            # get selected line index
            index = listbox.curselection()[0]
            # get th e line's text
            global seltext
            seltext = listbox.get(index)
        # left mouse click on a list item to display selection
        listbox.bind('<ButtonRelease-1>', get_list)
 
     
    