Python/Tkinter how concerve selection on several listbox?

  python, tkinter

I have this windoww :

enter image description here

When i make a selection on one of my Listbox i lose my selection on my other listbox. But i need to concerve all my selections to get them all in my DB. I don’t have any difficult to get my datas in my DB but i can’t concerve my selections. I try my best but i can’t reach my goal.

Here my code

def fen_event():
    conn = connection()
    my_cursor = conn.cursor()
    
    my_cursor.execute("SELECT * FROM theater")
    theaters = my_cursor.fetchall()
    
    my_cursor.execute("SELECT * FROM actor")
    actors = my_cursor.fetchall()
    conn.commit()


    widgets_fen_event = Tk()
    widgets_fen_event.title("theater")


    Label(widgets_fen_event, text="Name").grid(row=0, column=0)
    name = Entry(widgets_fen_event)
    name.grid(row=0, column=1)

    Label(widgets_fen_event, text="Theater").grid(row=0, column=2)
    select_theater = Listbox()
    select_theater.grid(row=0, column=3)

    for theater in theaters:
        select_theater.insert(END, theater)

    Label(widgets_fen_event, text="Actor").grid(row=0, column=4)
    select_actor = Listbox(selectmode="multiple")
    select_actor.grid(row=0, column=5)

    for actor in actors:
        select_actor.insert(END, actor)

Source: Python Questions

LEAVE A COMMENT