Is there way to disable all widget in tk window with single proc? argument can be just initial toplevel path.
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
Given a widget, you can get all of the children of that widget with [winfo children]. With a tiny recursive procedure you can act upon every widget in a tree of widgets. If you want to be lazy, you can usually also get a list of all widgets by doing [info commands .*]. That is often Good Enough, unless your application creates procedures or images with a name that begin with “.”.
Most tk widgets accept a “-state” option, and those that don’t can usually be ignored since state doesn’t matter (for example, a frame widget). So, you can iterate over all the widgets and do something like [catch {$widget configure -state disabled}]. This won’t work if you have unusual widgets that need to be enabled or disabled by some other means (such as the ttk button which has a “state” subcommand).
If you have a simple application using standard widgets, something like this may be Good Enough:
For precise control you can use “[winfo class $widget]” to get the class of the widget, and do different commands depending on the class.