| Ticket UUID: | a7908c88d41607d4ea3e8cec657c9729f5766e8 | |||
| Title: | Popups don't follow options db | |||
| Type: | Bug | Version: | 8.5 - 8.7a1 | |
| Submitter: | djarseneau | Created on: | 2018-12-01 04:58:15 | |
| Subsystem: | 60. [tk_setPalette] | Assigned To: | nobody | |
| Priority: | 5 Medium | Severity: | Cosmetic | |
| Status: | Closed | Last Modified: | 2026-10-22 17:22:38 | |
| Resolution: | Fixed | Closed By: | serhiy.storchaka | |
| Closed on: | 2026-09-25 09:16:01 | |||
| Description: |
This is an old problem. Since the non-native popup message commands
(implemented in tcl) were changed to use ttk, they don't follow the
appearance settings in traditional Tk programs. Of course it is good
that they follow the style settings in ttk gui programs, and it seems
impractical to merge the options database with ttk::style at this stage.
As a minimal fix, I suggest patching tk_setPalette to apply some of
the options to the ttk::style. Patch shown below. This initial patch
only applies the colors that tk_setPalette is sure to always set in
the option database.
If this path forward is not rejected outright, I can see what other
(optional) option db values would cover the style values used by all
the transient dialogs (tk_messageBox, tk_getOpenFile ...)
# Problem demo
button .b1 -text "PUSH ME" -command pinkypal
button .b2 -text "THEN ME" -command msgpop
label .l -text [info patchlevel]
grid .l -padx 10 -pady 10
grid .b1 -padx 10 -pady 3
grid .b2 -padx 10 -pady 10
proc pinkypal { } {
set mybgcol \#ffaacc
tk_setPalette $mybgcol
option add *background $mybgcol
}
proc msgpop { } {
tk_messageBox -message "Look at my color"
}
minimal patch to palette.tcl
option add *$option $new($option) widgetDefault
}
+ # Minimal adjustment to ttk style
+
+ ::ttk::style map . -background [list active $new(activeBackground) {} $new(background)]
+ ::ttk::style map . -foreground [list active $new(activeForeground) \
+ disabled $new(disabledForeground) {} $new(foreground)]
+
# Save the options in the variable ::tk::Palette, for use the
# next time we change the options.
| |||
| User Comments: |
serhiy.storchaka added on 2026-09-25 09:16:01:
Fixed in 9.0 by TIP 645 ([755608c3bc]): fvogel added on 2022-10-15 14:55:28: (Try again...) See TIP #645. fvogel added on 2022-10-15 14:54:33: See https://core.tcl-lang.org/tips/doc/trunk/tip/645.md[TIP #645. bll added on 2018-12-04 05:36:26: Actually, I think my objection is incorrect. tk_setPalette is not used within Tk anywhere excepting the demos. It's not a useful action with ttk widgets. So I think there is no issue. djarseneau (claiming to be Donald Arseneau) added on 2018-12-04 05:16:12: I thought there might be an aversion to corrupting ttk with "legacy" formatting controls. Also, the patch is probably not ready for real use since it is very minimal and simple-minded. What do people think should happen when someone sets a style and then invokes tk_setPalette (with different colors)? I'm thinking that with some more work, more option settings given as optional arguments to tk_setPalette could be used to set more style values, and this would be an explicit feature. bll added on 2018-12-02 20:36:23: If the user has already changed the . mapping, this would override their changes. fvogel added on 2018-12-02 09:50:51: Thanks for the patch! Looks sensible, at least for Linux (on macOS and Windows this does not change the color of the popup due to using their native counterpart). I have committed your patch in bugfix branch bug-a7908c88d4. The work can continue in that branch. You seem to fear that this path could be rejected outright, why this? Do you see any drawbacks in your approach? | |||
Home
Timeline
Branches
Tags
Forum
Tickets
Download
Wiki