Bottom Page

Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
 Update value selected in option menu when select an item from text box
#1
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.


Attached Files Thumbnail(s)
   

.py   Creating_frontend_udemy.py (Size: 3.69 KB / Downloads: 57)
.py   backend_udemy.py (Size: 1.78 KB / Downloads: 61)
Quote
#2
try updating e1 widget directly (which I can't see)
Quote
#3
(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)

İmage


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.
Quote

Top Page

Possibly Related Threads...
Thread Author Replies Views Last Post
  Update a label text from subprocess jim53 3 372 Aug-19-2019, 08:21 PM
Last Post: Denni
  Unable to update or refresh label text in tkinter jenkins43 3 358 Jul-24-2019, 02:09 PM
Last Post: Friend
  [Tkinter] Select All text without space on the righthand side Vicolas 1 399 Feb-28-2019, 06:49 PM
Last Post: Larz60+
  Display and update the label text which display the serial value jenkins43 5 1,187 Feb-04-2019, 04:36 AM
Last Post: Larz60+
  [Tkinter] update the content of Text widget atlass218 10 5,089 Dec-15-2018, 11:51 AM
Last Post: atlass218
  [PyQt]Find item or text in Qtablewidget maziio 0 3,748 Aug-06-2018, 01:37 PM
Last Post: maziio
  printing option menu variable in label in Tkinter SmokerX 1 2,484 Jan-18-2018, 07:36 PM
Last Post: SmokerX
  Cancel update of text of QPlainTextEdit if terms not satisfied panoss 0 1,212 May-24-2017, 05:11 PM
Last Post: panoss
  Bokeh - dynamic update widget.Select values sixteenornumber 0 6,541 Dec-28-2016, 02:15 PM
Last Post: sixteenornumber

Forum Jump:


Users browsing this thread: 1 Guest(s)