python - Is there a way to gray out (disable) a tkinter Frame? -


I want to create a GUI in the tanker with two frames, and frame graded down until something happens Ho.

Some example code is:

  to tkinter import from * tkinter import ttk def enabled (): frame2.state (statespec = 'enabled ') # Error root = Tk () # top frame frame 1 = ttk.LabelFrame (root, padding = (10,10,10,10)) frame 1. Grid (column = 0, line = 0, padx = 10, padi) = 10) button 2 = ttk.button (frame 1, text = "it enables the bottom limit", command = enable) button2.pack () # Creations below frame frame 2 = T.T.Label Frame (root, padding = (10,10,10, 10)) frame 2. Grid (column = 0, line = 1, padx = 10, pd = 10) frame 2 State (statepak = 'disabled') # Error entry = ttk.Entry (frame2) entry.pack () button2 = Ttk.Button (frame2, text = "button") button2.pack () root.mainloop ()   

Is it possible that all widgets in frame 2 are grayed out individually?

I am using Tkinter 8.5 and Python 3.3.

Of course this is not elegant, but I found a solution by adding

  in frame 2.winfo_children () for the child: child.configure (state = 'disabled')   

which hides and disables children from every frame 2 And, with enabling , essentially to reverse it

  def enabled (childList): child list for child in: Child.configure (state = 'enable')   

its Besides, I've removed the frame2.state (statespec = 'disabled') because it does not have to be necessary for me and throws an error apart from it.

Full code here: From Tiketter imports to Teekter Def enabled (Child list): Child list for children: Children. Configure (state = 'enabled') root = tc () # top frame frame 1 = ttk.LabelFrame (root, padding = (10,10,10,10)) frame 1. Grid (column = 0, line = 0, padx = 10, pdf = 10) button 2 = ttec button (frame 1, text = "it enables the bottom limit", command = lambda: na bleph (frame2. Vinoy_Khilden ())) Button 2.pack () # Creates frame frame below 2 = TTIC. Label Frame (root, padding = (10, 10, 10, 10) frame 2. Grid (column = 0, line = 1, padx = 10, pady = 10) entry = ttk.Entry (frame2) entry.pack () button2 = ttk.Button (frame2, text = "button") button 2.pack ( ) In frame 2 Wwinfo_children (): child .configure (state = 'disable') root.mainloop ()

Comments

Popular posts from this blog

ios - Adding an SKSpriteNode to SKScene from a child SKSpriteNode -

Matlab transpose a table vector -

c# - Textbox not clickable but editable -