From: Marc C. <mar...@gm...> - 2025-10-07 18:00:44
|
The background color used by Tk for a Tk window and for a Ttk Frame is an Apple "semantic color" aptly named WindowBackgroundColor. The rgb values for semantic colors depend on the Appearance (Aqua or Dark) and are determined by the system. You can view the rgb values by calling the winfo_rgb method: `root.winfo_rgb("systemWindowBackgroundColor") That method calls the Tk command `winfo rgb , systemWindowBackgroundColor`. There is something pretty complicated going on here. This is what I see on my Tahoe system with various versions of python and wish: ## Python 3.13 from python.org >>> import tkinter >>> root = tkinter.Tk() >>> root.eval("info patchlevel") '8.6.16' >>> root.winfo_rgb("systemWindowBackgroundColor") (60652, 60652, 60652) ## Python 3.13 built with Tk 9.0.1 >>> import tkinter >>> root = tkinter.Tk() >>> root.eval("info patchlevel") '9.0.1' >>> root.winfo_rgb("systemWindowBackgroundColor") (60652, 60652, 60652) ## Wish 9.0 % info patchlevel 9.0.2 % winfo rgb . systemWindowBackgroundColor 60652 60652 60652 ## Wish 9.1 % info patchlevel 9.1a0 % winfo rgb . systemWindowBackgroundColor 65535 65535 65535 As you can see, Wish 9.1 changes the background color to white instead of light gray. However, I don't think this has anything to do with the version of Tk being used. I think it may have to do with the SDK version used when compiling Tk. On my system, wish9.0 was built with the 15.5.0 SDK (before I installed Tahoe) and wish9.1 was built with the 26.0.0 SDK. Note that the target OS (i.e. the one specified with -mmacosx-version-min) was 11.0 in both cases. I imagine that the core issue is whether the build sdk supports "Liquid Glass" or not. In any case, I don't think this is something that can be addressed by Tk, assuming that I am correct that the behavior depends on the SDK version used to build Tk. Perhaps it can be addressed by developers by specifying which SDK to use when building an app. - Marc On Tue, Oct 7, 2025 at 11:35 AM Andrew Murray <rad...@gm...> wrote: > Hi. Using Tcl 8.6.17 from Python on macOS Sequoia and Tahoe, I find that > Sequoia has a gray background, but Tahoe has a white background. This may > well be intentional, and an accepted part of Apple's updated designs, but I > just wanted to check if that is the case? Or is it something of a bug that > a future Tcl will address? Thanks > > import tkinter as tk > from tkinter import ttk > > root = tk.Tk() > root.geometry("200x100") > > main_frame = ttk.Frame(root, padding=20, borderwidth=2) > main_frame.pack(fill="both", expand=True) > > label = ttk.Label(main_frame, text="Label") > label.pack() > > root.mainloop() > > _______________________________________________ > Tcl-mac mailing list > tc...@li... > https://lists.sourceforge.net/lists/listinfo/tcl-mac > |