Python Forum

Full Version: Update value selected in option menu when select an item from text box
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
In my GUI using tkinter, I'm trying to update the value display for option menu based on selected row function.

def get_selected_row(event):
    try:
        global selected_tuple
        index=list1.curselection()[0]
        selected_tuple=list1.get(index)
        e1.delete(0,END)
        e1.insert(END,selected_tuple[1])
        e2.delete(0,END)
        e2.insert(END,selected_tuple[2])
        e3.delete(0,END)
        e3.insert(END,selected_tuple[3])
        e4.delete(0,END)
        e4.insert(END,selected_tuple[4])
        #avial_typeSelect_text.setvar(textvar,selected_tuple[5])
        #avial_typeSelect_text.update()
        avial_typeSelect_text['menu'].delete(0,END)
        #avial_typeSelect_text['menu'].add_command( command=tk._setit(avial_text, selected_tuple[5]))
        avial_typeSelect_text['menu'].update(END,selected_tuple[5])
        print(selected_tuple[5])
    except IndexError:
        pass
However this was not successful.In the attached picture shows that value of the filed "Availability" is "No" in the database. But value shows in the option menu is not updated according to selected row.

Appreciate if someone can give a though on how to do this.

Both backed & front end files attached. Sample database can't be attached. So pls. input some sample data and add data to create a sqlite database.
try updating e1 widget directly (which I can't see)
(Jun-06-2019, 04:00 AM)Larz60+ Wrote: [ -> ]try updating e1 widget directly (which I can't see)
Thanks for the reply.

e1, e2,e3,e4 get the values of selected items correctly.

However i'm unable to get the selected items value into option menu (ie avial_typeSelect_text)

[Image: AF1QipNcU_MWbgzegUmum5Wu_Q_-5s4AysmOx9j4HWbO]

Please note i have attached full python code files (front end & back end) but what is noted in my question is only a function used to update the values based on selected item.