mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
changed transparent color value from None to "transparent", fixed type hints, added color type and value checking
This commit is contained in:
@ -4,7 +4,7 @@ import sys
|
||||
import os
|
||||
import platform
|
||||
import ctypes
|
||||
from typing import Union, Tuple
|
||||
from typing import Union, Tuple, Optional
|
||||
|
||||
from .widgets.theme.theme_manager import ThemeManager
|
||||
from .widgets.scaling.scaling_base_class import CTkScalingBaseClass
|
||||
@ -19,15 +19,15 @@ class CTkToplevel(tkinter.Toplevel, CTkAppearanceModeBaseClass, CTkScalingBaseCl
|
||||
For detailed information check out the documentation.
|
||||
"""
|
||||
|
||||
_valid_tk_toplevel_arguments = {"bd", "borderwidth", "class", "container", "cursor", "height",
|
||||
_valid_tk_toplevel_arguments: set = {"bd", "borderwidth", "class", "container", "cursor", "height",
|
||||
"highlightbackground", "highlightthickness", "menu", "relief",
|
||||
"screen", "takefocus", "use", "visual", "width"}
|
||||
|
||||
_deactivate_macos_window_header_manipulation = False
|
||||
_deactivate_windows_window_header_manipulation = False
|
||||
_deactivate_macos_window_header_manipulation: bool = False
|
||||
_deactivate_windows_window_header_manipulation: bool = False
|
||||
|
||||
def __init__(self, *args,
|
||||
fg_color: Union[str, Tuple[str, str]] = "default_theme",
|
||||
fg_color: Optional[Union[str, Tuple[str, str]]] = None,
|
||||
**kwargs):
|
||||
|
||||
self._enable_macos_dark_title_bar()
|
||||
@ -46,7 +46,7 @@ class CTkToplevel(tkinter.Toplevel, CTkAppearanceModeBaseClass, CTkScalingBaseCl
|
||||
self._max_height: int = 1_000_000
|
||||
self._last_resizable_args: Union[Tuple[list, dict], None] = None # (args, kwargs)
|
||||
|
||||
self._fg_color = ThemeManager.theme["color"]["window"] if fg_color == "default_theme" else fg_color
|
||||
self._fg_color = ThemeManager.theme["color"]["window"] if fg_color is None else self._check_color_type(fg_color)
|
||||
|
||||
# set bg color of tkinter.Toplevel
|
||||
super().configure(bg=self._apply_appearance_mode(self._fg_color))
|
||||
@ -153,7 +153,7 @@ class CTkToplevel(tkinter.Toplevel, CTkAppearanceModeBaseClass, CTkScalingBaseCl
|
||||
|
||||
def configure(self, **kwargs):
|
||||
if "fg_color" in kwargs:
|
||||
self._fg_color = kwargs.pop("fg_color")
|
||||
self._fg_color = self._check_color_type(kwargs.pop("fg_color"))
|
||||
super().configure(bg=self._apply_appearance_mode(self._fg_color))
|
||||
|
||||
for child in self.winfo_children():
|
||||
|
Reference in New Issue
Block a user