2022-12-01 12:06:54 +03:00
|
|
|
__version__ = "5.0.1"
|
2021-07-13 12:23:34 +03:00
|
|
|
|
2022-05-17 22:44:59 +03:00
|
|
|
import os
|
|
|
|
import sys
|
2022-11-11 15:06:26 +03:00
|
|
|
from tkinter import Variable, StringVar, IntVar, DoubleVar, BooleanVar
|
|
|
|
from tkinter.constants import *
|
2022-11-12 16:01:54 +03:00
|
|
|
import tkinter.filedialog as filedialog
|
2022-11-11 15:06:26 +03:00
|
|
|
|
2022-05-17 22:44:59 +03:00
|
|
|
# import manager classes
|
2022-11-29 21:06:33 +03:00
|
|
|
from .windows.widgets.appearance_mode import AppearanceModeTracker
|
|
|
|
from .windows.widgets.font import FontManager
|
|
|
|
from .windows.widgets.scaling import ScalingTracker
|
|
|
|
from .windows.widgets.theme import ThemeManager
|
|
|
|
from .windows.widgets.core_rendering import DrawEngine
|
2022-05-17 22:44:59 +03:00
|
|
|
|
2022-12-06 13:09:34 +03:00
|
|
|
# import base widgets
|
|
|
|
from .windows.widgets.core_rendering import CTkCanvas
|
|
|
|
from .windows.widgets.core_widget_classes import CTkBaseClass
|
|
|
|
|
2022-05-16 17:51:19 +03:00
|
|
|
# import widgets
|
2022-11-29 21:06:33 +03:00
|
|
|
from .windows.widgets import CTkButton
|
|
|
|
from .windows.widgets import CTkCheckBox
|
|
|
|
from .windows.widgets import CTkComboBox
|
|
|
|
from .windows.widgets import CTkEntry
|
|
|
|
from .windows.widgets import CTkFrame
|
|
|
|
from .windows.widgets import CTkLabel
|
|
|
|
from .windows.widgets import CTkOptionMenu
|
|
|
|
from .windows.widgets import CTkProgressBar
|
|
|
|
from .windows.widgets import CTkRadioButton
|
|
|
|
from .windows.widgets import CTkScrollbar
|
|
|
|
from .windows.widgets import CTkSegmentedButton
|
|
|
|
from .windows.widgets import CTkSlider
|
|
|
|
from .windows.widgets import CTkSwitch
|
|
|
|
from .windows.widgets import CTkTabview
|
|
|
|
from .windows.widgets import CTkTextbox
|
2022-05-02 00:29:14 +03:00
|
|
|
|
2022-05-16 17:51:19 +03:00
|
|
|
# import windows
|
2022-11-29 21:06:33 +03:00
|
|
|
from .windows import CTk
|
|
|
|
from .windows import CTkToplevel
|
|
|
|
from .windows import CTkInputDialog
|
2021-03-04 20:27:46 +03:00
|
|
|
|
2022-11-29 21:06:33 +03:00
|
|
|
# import font classes
|
|
|
|
from .windows.widgets.font import CTkFont
|
2022-10-16 21:13:19 +03:00
|
|
|
|
2022-11-29 21:06:33 +03:00
|
|
|
# import image classes
|
|
|
|
from .windows.widgets.image import CTkImage
|
|
|
|
|
|
|
|
_ = Variable, StringVar, IntVar, DoubleVar, BooleanVar, CENTER, filedialog # prevent IDE from removing unused imports
|
2022-11-01 02:37:30 +03:00
|
|
|
|
2021-03-04 20:27:46 +03:00
|
|
|
|
2022-05-22 02:55:58 +03:00
|
|
|
def set_appearance_mode(mode_string: str):
|
|
|
|
""" possible values: light, dark, system """
|
2021-03-04 20:27:46 +03:00
|
|
|
AppearanceModeTracker.set_appearance_mode(mode_string)
|
|
|
|
|
|
|
|
|
2022-05-22 02:55:58 +03:00
|
|
|
def get_appearance_mode() -> str:
|
|
|
|
""" get current state of the appearance mode (light or dark) """
|
2021-03-04 20:27:46 +03:00
|
|
|
if AppearanceModeTracker.appearance_mode == 0:
|
|
|
|
return "Light"
|
|
|
|
elif AppearanceModeTracker.appearance_mode == 1:
|
|
|
|
return "Dark"
|
|
|
|
|
|
|
|
|
2022-05-22 02:55:58 +03:00
|
|
|
def set_default_color_theme(color_string: str):
|
|
|
|
""" set color theme or load custom theme file by passing the path """
|
2022-05-17 22:44:59 +03:00
|
|
|
ThemeManager.load_theme(color_string)
|
2022-02-21 17:35:08 +03:00
|
|
|
|
|
|
|
|
2022-05-22 02:55:58 +03:00
|
|
|
def set_widget_scaling(scaling_value: float):
|
|
|
|
""" set scaling for the widget dimensions """
|
2022-05-05 21:25:37 +03:00
|
|
|
ScalingTracker.set_widget_scaling(scaling_value)
|
2022-05-22 01:02:45 +03:00
|
|
|
|
|
|
|
|
2022-05-22 02:55:58 +03:00
|
|
|
def set_window_scaling(scaling_value: float):
|
|
|
|
""" set scaling for window dimensions """
|
|
|
|
ScalingTracker.set_window_scaling(scaling_value)
|
|
|
|
|
|
|
|
|
2022-05-22 01:02:45 +03:00
|
|
|
def deactivate_automatic_dpi_awareness():
|
2022-05-22 02:55:58 +03:00
|
|
|
""" deactivate DPI awareness of current process (windll.shcore.SetProcessDpiAwareness(0)) """
|
2022-05-22 01:02:45 +03:00
|
|
|
ScalingTracker.deactivate_automatic_dpi_awareness = False
|