My image looks fine when it is on a normal button. When I change the state of the button to disabled the image is stippled. Is there a way to change this default behaviour?
Am 26.02.25 um 23:49 schrieb Martin (m0h):
My image looks fine when it is on a normal button. When I change the
state of the button to disabled the image is stippled. Is there a way
to change this default behaviour?
This is intended in order to provide visual feedback. If you use a ttk::button, you can provide your own disabled image instead. Create a disabled image e.g. grayscale or toned-down version, and then pass a
list to -image. YOu can specify multiple images for different states of
the button, so that should be
"normalimage disabled disabledimage" (untested)
See: https://www.tcl-lang.org/man/tcl/TkCmd/ttk_widget.htm#M-image
Christian
shows the information icon% .b state disabled
shows the error icon
Am 26.02.25 um 23:49 schrieb Martin (m0h):Hello Christian,
My image looks fine when it is on a normal button. When I change the state of the button to disabled the image is stippled. Is there a way to change this default behaviour?
This is intended in order to provide visual feedback. If you use a ttk::button, you can provide your own disabled image instead. Create a disabled image e.g. grayscale or toned-down version, and then pass a
list to -image. YOu can specify multiple images for different states of
the button, so that should be
"normalimage disabled disabledimage" (untested)
See: https://www.tcl-lang.org/man/tcl/TkCmd/ttk_widget.htm#M-image
Christian
Am 27.02.2025 um 08:11 schrieb Christian Gollwitzer:Hello Harald,
Am 26.02.25 um 23:49 schrieb Martin (m0h):
My image looks fine when it is on a normal button. When I change the
state of the button to disabled the image is stippled. Is there a way
to change this default behaviour?
This is intended in order to provide visual feedback. If you use a ttk::button, you can provide your own disabled image instead. Create a disabled image e.g. grayscale or toned-down version, and then pass a
list to -image. YOu can specify multiple images for different states of the button, so that should be
"normalimage disabled disabledimage" (untested)
See: https://www.tcl-lang.org/man/tcl/TkCmd/ttk_widget.htm#M-image
Christian
Wow, I did not know this trick, awesome !
Here is an example with the disabled state on tk 8.6:
% ttk::button .b -image {::tk::icons::information disabled ::tk::icons::error}
% pack .b
shows the information icon% .b state disabled
shows the error icon
GREAT !!!
Thanks Christian,
Harald
It is definetly good to know this feature exists, although I will have to see if it is worth the effort to implement this into my application as I rely on Tk buttons currently.
Sysop: | DaiTengu |
---|---|
Location: | Appleton, WI |
Users: | 1,028 |
Nodes: | 10 (0 / 10) |
Uptime: | 128:08:21 |
Calls: | 13,329 |
Calls today: | 1 |
Files: | 186,574 |
D/L today: |
438 files (98,755K bytes) |
Messages: | 3,355,231 |