字数 9 个 阅读时间不到 1 分钟 访问量
Support for theme
- darkdetect: albertosottile/darkdetect
- pywinstyles: Akascape/py-window-styles
- win32material: littlewhitecloud/win32material
- hPyT: Zingzy/hPyT
函数:
-  set_color_mode–Set the color mode of the program 
-  get_color_mode–Get the color mode of the program. 
-  register_event–When the system accent color changes, the registered function will be 
-  remove_event–Remove a registered function. 
-  apply_file_dnd–Apply file drag and drop in a widget. 
-  apply_theme–Apply some Windows themes to the window. 
-  customize_window–Customize the relevant properties of the window 
 
  Set the color mode of the program
- mode: it can be- "light",- "dark", and- "system"
TIP:
"system" is the following system
 
  Get the color mode of the program.
 
  When the system accent color changes, the registered function will be called, and the parameter is a boolean value indicating whether it is currently a dark theme.
- func: callback function
- args: extra arguments
 
 remove_event(func: collections.abc.Callable[..., typing.Any]) -> None
Remove a registered function.
- func: callback function
 
  Apply file drag and drop in a widget.
- window: the window which being customized
- command: callback function, accept a parameter that represents the path of the file
This function is only works on Windows OS!
 
 apply_theme(
    window: tkinter.Tk,
    *,
    theme: typing.Literal[
        "mica",
        "acrylic",
        "acrylic2",
        "aero",
        "transparent",
        "optimised",
        "win7",
        "inverse",
        "native",
        "popup",
        "dark",
        "normal",
    ]
) -> None
Apply some Windows themes to the window.
- window: the window which being customized
- theme: different themes for windows
This function is only works on Windows OS! And some parameters are useless on Windows 7/10!
 
 customize_window(
    window: tkinter.Tk,
    *,
    border_color: str | None = None,
    header_color: str | None = None,
    title_color: str | None = None,
    hide_title_bar: bool | None = None,
    hide_button: typing.Literal["all", "maxmin", "none"] | None = None,
    disable_minimize_button: bool | None = None,
    disable_maximize_button: bool | None = None,
    border_type: typing.Literal["rectangular", "smallround", "round"] | None = None
) -> None
Customize the relevant properties of the window
- window: the window which being customized
- border_color: border color of the window
- header_color: header color of the window
- title_color: title color of the window
- hide_title_bar: whether hide the whole title bar
- hide_button: whether hide part of buttons on title bar
- disable_minimize_button: whether disable minimize button
- disable_maximize_button: whether disable maximize button
- border_type: border type of the window
This function is only works on Windows OS! And some parameters are useless on Windows 7/10!