Python Forum

Full Version: How to show and hide tkinter entry box when select yes from drop down
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Hi,

i have created an entry form for personal use using tkinter. Now i want to add a function in it that when yes if select from drop down show entry box otherwise hide it.

i have written the codes but it is not working neither
throwing the error below is the snippet of my code
field = ["YES",""]
query_text = StringVar()
lblname = Label(f1aa, font=("arial", 10, "bold"), text="Query/Reply", bd=8, anchor="w")
lblname.grid(row=0, column=0, sticky=W)
txtname28 = OptionMenu(f1aa, query_text, *field)
txtname28.grid(row=0, column=1, sticky=W)
    
hidden = False
hidden_text = StringVar()
e = Entry(f1aa, font=("arial", 10, "bold"), bd=8, justify="left", textvariable = hidden_text)
e.grid(row=0, column=2)
    
if query_text == "YES":
    e.grid()
else:
    e.grid_remove()
#hidden = not hidden
use lift and lower to hide widgets