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
  Entry Validation in tkinter shahulvk 4 596 Oct-28-2020, 10:12 PM
Last Post: joe_momma
  [Tkinter] Getting Input from Tkinter Entry juliabrushett 6 13,880 May-30-2020, 03:29 PM
Last Post: Larz60+
  Converting Entry field value to integer in tkinter scratchmyhead 2 1,201 May-11-2020, 03:41 PM
Last Post: scratchmyhead
  [Tkinter] Tkinter adding entry values scratchmyhead 1 595 May-04-2020, 05:21 AM
Last Post: Yoriz
  [Tkinter] Entry box not showing 2 decimal places Chuck_Norwich 3 1,122 Apr-24-2020, 05:28 PM
Last Post: deanhystad
  Always lowercase entry in tkinter ReturnName 8 1,380 Apr-18-2020, 09:41 AM
Last Post: PeroPuri
  Can't Get Entry Var in Tkinter OCaraDoBaixo 1 1,009 Feb-18-2020, 06:08 PM
Last Post: Larz60+
  Transfer Toplevel window entry to root window entry with TKinter HBH 0 1,768 Jan-23-2020, 09:00 PM
Last Post: HBH
  Newbie question with Tkinter Entry mariolopes 2 719 Oct-12-2019, 11:02 PM
Last Post: Larz60+
  [PyQt] Hide Dock Icon for QSystemTrayIcon App AeglosGreeenleaf 0 1,159 Jun-20-2019, 07:21 PM
Last Post: AeglosGreeenleaf

Forum Jump:

User Panel Messages

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