removed Settings class, moved settings to widgets and windows, added 'jusitfy' attribute to combobox and 'anchor' to optionmenu #528, added 'hover' attribute to all widgets and configure and cget methods, fixed missing attributes in configure

This commit is contained in:
Tom Schimansky
2022-10-22 14:24:04 +02:00
parent 9d7eca7bb1
commit 25531cdf50
15 changed files with 205 additions and 166 deletions

View File

@ -9,7 +9,6 @@ from typing import Union, Tuple
from ..appearance_mode_tracker import AppearanceModeTracker
from ..theme_manager import ThemeManager
from ..settings import Settings
from ..scaling_tracker import ScalingTracker
from ..utility.utility_functions import pop_from_dict_by_set, check_kwargs_empty
@ -25,6 +24,9 @@ class CTkToplevel(tkinter.Toplevel):
"highlightbackground", "highlightthickness", "menu", "relief",
"screen", "takefocus", "use", "visual", "width"}
_deactivate_macos_window_header_manipulation = False
_deactivate_windows_window_header_manipulation = False
def __init__(self, *args,
fg_color: Union[str, Tuple[str, str]] = "default_theme",
**kwargs):
@ -219,16 +221,16 @@ class CTkToplevel(tkinter.Toplevel):
else:
return super().cget(attribute_name)
@staticmethod
def _enable_macos_dark_title_bar():
if sys.platform == "darwin" and not Settings.deactivate_macos_window_header_manipulation: # macOS
@classmethod
def _enable_macos_dark_title_bar(cls):
if sys.platform == "darwin" and not cls._deactivate_macos_window_header_manipulation: # macOS
if Version(platform.python_version()) < Version("3.10"):
if Version(tkinter.Tcl().call("info", "patchlevel")) >= Version("8.6.9"): # Tcl/Tk >= 8.6.9
os.system("defaults write -g NSRequiresAquaSystemAppearance -bool No")
@staticmethod
def _disable_macos_dark_title_bar():
if sys.platform == "darwin" and not Settings.deactivate_macos_window_header_manipulation: # macOS
@classmethod
def _disable_macos_dark_title_bar(cls):
if sys.platform == "darwin" and not cls._deactivate_macos_window_header_manipulation: # macOS
if Version(platform.python_version()) < Version("3.10"):
if Version(tkinter.Tcl().call("info", "patchlevel")) >= Version("8.6.9"): # Tcl/Tk >= 8.6.9
os.system("defaults delete -g NSRequiresAquaSystemAppearance")
@ -245,7 +247,7 @@ class CTkToplevel(tkinter.Toplevel):
https://docs.microsoft.com/en-us/windows/win32/api/dwmapi/ne-dwmapi-dwmwindowattribute
"""
if sys.platform.startswith("win") and not Settings.deactivate_windows_window_header_manipulation:
if sys.platform.startswith("win") and not self._deactivate_windows_window_header_manipulation:
self._state_before_windows_set_titlebar_color = self.state()
super().withdraw() # hide window so that it can be redrawn after the titlebar change so that the color change is visible