From: Arjan on
Hi!

I have a development version of a gui that runs ahead of operational
functionality of the programs that are activated by the gui. Therefore
I would like to temporarily set certain portions of the gui to "-state
disabled". It works when I e.g. add the flag "-state disabled" to a
"checkbutton". The gui is organized in blocks:

grid .puff_label -column 0 -row 0 -columnspan 7 -sticky nw
grid\
[::ttk::labelframe .general -text "General" ]\
[::ttk::labelframe .release -text "Release" ]\
[::ttk::labelframe .meteo -text "Meteo" ]\
-sticky news
grid\
[::ttk::labelframe .run -text "Run" ]\
[::ttk::labelframe .sampling -text "Sampling" ]\
[::ttk::labelframe .dispersion -text "Dispersion"]\
-sticky news
grid\
[::ttk::labelframe .dose -text "Optimize nuclide set for" ]\
[::ttk::button .runpuff -text "Run LaPuffetta" -command
donuclidereduction]\
-sticky news
grid .logo_label -column 2 -row 3 -columnspan 3 -sticky se


--> Is there a simple way to disable e.g. everything (all the labels,
the checkbuttons, the entries and the comboboxes) associated with
".release" in 1 go?

Regards,


Arjan
From: Arjen Markus on
On 3 feb, 11:07, Arjan <arjan.van.d...(a)rivm.nl> wrote:
> Hi!
>
> I have a development version of a gui that runs ahead of operational
> functionality of the programs that are activated by the gui. Therefore
> I would like to temporarily set certain portions of the gui to "-state
> disabled". It works when I e.g. add the flag "-state disabled" to a
> "checkbutton". The gui is organized in blocks:
>
> grid .puff_label -column 0 -row 0 -columnspan 7 -sticky nw
> grid\
>  [::ttk::labelframe .general    -text "General"   ]\
>  [::ttk::labelframe .release    -text "Release"   ]\
>  [::ttk::labelframe .meteo      -text "Meteo"     ]\
>  -sticky news
> grid\
>  [::ttk::labelframe .run           -text "Run"       ]\
>  [::ttk::labelframe .sampling   -text "Sampling"  ]\
>  [::ttk::labelframe .dispersion -text "Dispersion"]\
>  -sticky news
> grid\
>  [::ttk::labelframe .dose    -text "Optimize nuclide set for"      ]\
>  [::ttk::button     .runpuff    -text "Run LaPuffetta" -command
> donuclidereduction]\
>  -sticky news
> grid .logo_label -column 2 -row 3 -columnspan 3 -sticky se
>
> --> Is there a simple way to disable e.g. everything (all the labels,
> the checkbuttons, the entries and the comboboxes) associated with
> ".release" in 1 go?
>
> Regards,
>
> Arjan

You mean the widgets that are children of .release?
You can do that by:

foreach w [winfo children .release] {
$w configure -state disabled
}

(Possibly add [catch] because not all widgets have the -state option)

Regards,

Arjen
From: Arjan on
> You mean the widgets that are children of .release?

Yes.

> You can do that by:
> foreach w [winfo children .release] {$w configure -state disabled}

This works! Thanks!

> (Possibly add [catch] because not all widgets have the -state option)

Did not seem to be necessary in my case.

Thanks for helping me out!


Arjan
From: Donald Arseneau on
On Feb 3, 2:07 am, Arjan <arjan.van.d...(a)rivm.nl> wrote:
> --> Is there a simple way to disable e.g. everything (all the labels,
> the checkbuttons, the entries and the comboboxes) associated with
> ".release" in 1 go?

I have generally made a proc to enable/disable the
widgets in a wondow (toplevel) because there were
inconsistencies that made [foreach [winfo children..]]
not ideal. Like some widgets needed special handling.

Donald (Is your name not Arj'n?) Arseneau

From: Arjen Markus on
On 3 feb, 14:22, Donald Arseneau <a...(a)triumf.ca> wrote:
> On Feb 3, 2:07 am, Arjan <arjan.van.d...(a)rivm.nl> wrote:
>
> > --> Is there a simple way to disable e.g. everything (all the labels,
> > the checkbuttons, the entries and the comboboxes) associated with
> > ".release" in 1 go?
>
> I have generally made a proc to enable/disable the
> widgets in a wondow (toplevel) because there were
> inconsistencies that made [foreach [winfo children..]]
> not ideal.  Like some widgets needed special handling.
>
> Donald (Is your name not Arj'n?) Arseneau

Arjan and Arjen are two different persons :), though both Dutch.
Yes, it is confusing.

Regards,

Arj-e-n