Python Forum
[Tkinter] How to show and hide tkinter entry box when select yes from drop down
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[Tkinter] How to show and hide tkinter entry box when select yes from drop down
#1
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
Reply
#2
use lift and lower to hide widgets
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  [Tkinter] How to get the result of a ping to show in tkinter? jacklee26 6 7,831 Feb-10-2023, 01:12 PM
Last Post: NebularNerd
  [Tkinter] Open tkinter colorchooser at toplevel (so I can select/focus on either window) tabreturn 4 1,907 Jul-06-2022, 01:03 PM
Last Post: deanhystad
  [Tkinter] Making entry global in tkinter with multiprocessing luckyingermany 2 2,335 Jan-21-2022, 03:46 PM
Last Post: deanhystad
  Tkinter Exit Code based on Entry Widget Nu2Python 6 2,997 Oct-21-2021, 03:01 PM
Last Post: Nu2Python
  [Tkinter] Update variable using tkinter entry methon drSlump 6 5,208 Oct-15-2021, 08:01 AM
Last Post: drSlump
  Tkinter | entry output. Sap2ch 1 2,002 Sep-25-2021, 12:38 AM
Last Post: Yoriz
  [Tkinter] Hide clicked buttons Rubberduck 6 3,564 Jun-02-2021, 12:44 PM
Last Post: Rubberduck
  .get() from generated Entry widgets in tkinter snakes 4 4,233 May-03-2021, 11:26 PM
Last Post: snakes
  Entry Validation in tkinter shahulvk 4 16,364 Oct-28-2020, 10:12 PM
Last Post: joe_momma
  [Tkinter] Getting Input from Tkinter Entry juliabrushett 6 21,388 May-30-2020, 03:29 PM
Last Post: Larz60+

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020