Tk Source Code

View Ticket
Login
Ticket UUID: fa6a476c57e03e05bc20f72125f048caa68dc5a4
Title: switching windows themes does not register the new color.
Type: Bug Version: core-8-6-branch
Submitter: bll Created on: 2018-08-31 06:27:37
Subsystem: 88. Themed Tk Assigned To: nobody
Priority: 5 Medium Severity: Minor
Status: Closed Last Modified: 2019-12-04 22:43:30
Resolution: Wont Fix Closed By: bll
    Closed on: 2019-12-04 22:43:30
Description:
I guess the question is, is it important that Tk react in a dynamic 
fashion to theme changes?  If so, the following is a bug.

But if requiring the user to stop and restart Tk is reasonable, then
this is not a bug and can be closed.

At the moment, I am thinking that having Tk react dynamically
would be nice, but I don't think it is a requirement.


Windows 7:
Using the script below, I get the following output:

% source xyz.tcl
SystemButtonFace
blue
61680 61680 61680     #f0f0f0
# At this point, the script waits.
# I change the windows theme from the default to one of the
# high-contrast themes.
# Then I create the file xyz.txt.
# (I tried: gets stdin line; locked up the windows machine).
SystemButtonFace
SystemButtonFace
61680 61680 61680
% exit

The ttk::frame changes its background color, and now reports
its background as SystemButtonFace.  
But fetching the rgb for SystemButtonFace returns the old color.

I can tell I have a new theme, but I have no way of getting the
current colors for it.


package require Tk
ttk::frame .f -style B.TFrame -width 20 -height 20
ttk::style configure B.TFrame -background blue
pack .f
puts [ttk::style lookup TFrame -background]
puts [ttk::style lookup B.TFrame -background]
puts [winfo rgb . SystemButtonFace]
update
while { ! [file exists xyz.txt] } {
  set ::x 0
  after 1000 [list set ::x 1]
  vwait ::x
}
puts [ttk::style lookup TFrame -background]
puts [ttk::style lookup B.TFrame -background]
puts [winfo rgb . SystemButtonFace]