Python Forum
[Tkinter] How to show and hide tkinter entry box when select yes from drop down - Printable Version

+- Python Forum (https://python-forum.io)
+-- Forum: Python Coding (https://python-forum.io/forum-7.html)
+--- Forum: GUI (https://python-forum.io/forum-10.html)
+--- Thread: [Tkinter] How to show and hide tkinter entry box when select yes from drop down (/thread-10886.html)



How to show and hide tkinter entry box when select yes from drop down - Prince_Bhatia - Jun-12-2018

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



RE: How to show and hide tkinter entry box when select yes from drop down - Larz60+ - Jun-12-2018

use lift and lower to hide widgets