I'm trying to import a csv file into a listbox, then when I double click one of the entries I want it to be added to a second listbox on screen, so that I can set the entries in the second listbox to another variable that will be called later in the program.
Windows 10 Python 3.6 most recent pysimplegui
Here's what my code currently looks like:
def open_listbox(list_a) #list_a is a user defined csv from previous function
list_b = [] #initializing list_b
list_b.append([])
layout = [[sg.Listbox(values=list_a, key='-list_a-', enable_events=True, bind_return_key=True, size=(60, 20)), sg.Listbox(values=list_b, key='-list_b-', enable_events=True, bind_return_key=True, size=(60, 20))],
[sg.Ok(), sg.Cancel()]]
window = sg.Window('test', layout)
while True:
event, values = window.read()
if event == sg.WINDOW_CLOSED or event == 'Cancel':
break
elif event == list_a[int()]:
sg.clipboard_set(list_a[int()].append(list_b)
print(list_b)
elif event == 'Ok':
break
print(list_b)
window.close()
When I click on any of the entries nothing seems to happen, and in the terminal when it goes to print list_b right before closing the window it is always an empty list.