mirror of
https://github.com/TomSchimansky/CustomTkinter.git
synced 2023-08-10 21:13:13 +03:00
changed theme file format
This commit is contained in:
parent
a921eb824d
commit
01e64f38e8
@ -35,6 +35,7 @@ ToDo:
|
||||
- font attribute must be tuple or CTkFont now, all size values are measured in pixel now
|
||||
- Changed dictionary key 'window_bg_color' to 'window' in theme files
|
||||
- CTkInputDialog attributes completely changed
|
||||
- CTkScrollbar attributes scrollbar_color, scrollbar_hover_color changed to button_color, button_hover_color
|
||||
|
||||
### Removed
|
||||
- Removed setter and getter functions like set_text in CTkButton
|
||||
|
@ -1,82 +1,152 @@
|
||||
{
|
||||
"color": {
|
||||
"window": ["#EBEBEC", "#212325"],
|
||||
"button": ["#3B8ED0", "#1F6AA5"],
|
||||
"button_hover": ["#36719F", "#144870"],
|
||||
"button_border": ["#3E454A", "#949A9F"],
|
||||
"checkbox_border": ["#3E454A", "#949A9F"],
|
||||
"checkmark": ["#DCE4EE", "gray90"],
|
||||
"entry": ["#F9F9FA", "#343638"],
|
||||
"entry_border": ["#979DA2", "#565B5E"],
|
||||
"entry_placeholder_text": ["gray52", "gray62"],
|
||||
"frame_border": ["#979DA2", "#565B5E"],
|
||||
"frame_low": ["#D1D5D8", "#2A2D2E"],
|
||||
"frame_high": ["#C0C2C5", "#343638"],
|
||||
"label": "transparent",
|
||||
"text": ["gray10", "#DCE4EE"],
|
||||
"text_disabled": ["gray60", "gray45"],
|
||||
"text_button": ["#DCE4EE", "#DCE4EE"],
|
||||
"text_button_disabled": ["gray74", "gray60"],
|
||||
"progressbar": ["#939BA2", "#4A4D50"],
|
||||
"progressbar_progress": ["#3B8ED0", "#1F6AA5"],
|
||||
"progressbar_border": ["gray", "gray"],
|
||||
"slider": ["#939BA2", "#4A4D50"],
|
||||
"slider_progress": ["gray40", "#AAB0B5"],
|
||||
"slider_button": ["#3B8ED0", "#1F6AA5"],
|
||||
"slider_button_hover": ["#36719F", "#144870"],
|
||||
"switch": ["#939BA2", "#4A4D50"],
|
||||
"switch_progress": ["#3B8ED0", "#1F6AA5"],
|
||||
"switch_button": ["gray36", "#D5D9DE"],
|
||||
"switch_button_hover": ["gray20", "gray100"],
|
||||
"optionmenu_button": ["#36719F", "#144870"],
|
||||
"optionmenu_button_hover": ["#27577D", "#203A4F"],
|
||||
"combobox_border": ["#979DA2", "#565B5E"],
|
||||
"combobox_button_hover": ["#6E7174", "#7A848D"],
|
||||
"dropdown_color": ["gray90", "gray20"],
|
||||
"dropdown_hover": ["gray75", "gray28"],
|
||||
"dropdown_text": ["gray10", "#DCE4EE"],
|
||||
"scrollbar_button": ["gray55", "gray41"],
|
||||
"scrollbar_button_hover": ["gray40", "gray53"],
|
||||
"segmented_button": ["#979DA2", "#4A4D50"],
|
||||
"segmented_button_unselected": ["#979DA2", "#4A4D50"],
|
||||
"segmented_button_unselected_hover": ["gray70", "gray41"]
|
||||
"CTk": {
|
||||
"fg_color": ["#EBEBEC", "#212325"]
|
||||
},
|
||||
"text": {
|
||||
"CTkToplevel": {
|
||||
"fg_color": ["#EBEBEC", "#212325"]
|
||||
},
|
||||
"CTkFrame": {
|
||||
"corner_radius": 6,
|
||||
"border_width": 0,
|
||||
"fg_color": ["#D1D5D8", "#2A2D2E"],
|
||||
"top_fg_color": ["#C0C2C5", "#343638"],
|
||||
"border_color": ["#979DA2", "#565B5E"]
|
||||
},
|
||||
"CTkButton": {
|
||||
"corner_radius": 6,
|
||||
"border_width": 0,
|
||||
"fg_color": ["#3B8ED0", "#1F6AA5"],
|
||||
"hover_color": ["#36719F", "#144870"],
|
||||
"border_color": ["#3E454A", "#949A9F"],
|
||||
"text_color": ["#DCE4EE", "#DCE4EE"],
|
||||
"text_color_disabled": ["gray74", "gray60"]
|
||||
},
|
||||
"CTkLabel": {
|
||||
"corner_radius": 0,
|
||||
"fg_color": "transparent",
|
||||
"text_color": ["gray10", "#DCE4EE"]
|
||||
},
|
||||
"CTkEntry": {
|
||||
"corner_radius": 6,
|
||||
"border_width": 2,
|
||||
"fg_color": ["#F9F9FA", "#343638"],
|
||||
"border_color": ["#979DA2", "#565B5E"],
|
||||
"text_color":["gray10", "#DCE4EE"],
|
||||
"placeholder_text_color": ["gray52", "gray62"]
|
||||
},
|
||||
"CTkCheckbox": {
|
||||
"corner_radius": 6,
|
||||
"border_width": 3,
|
||||
"fg_color": ["#3B8ED0", "#1F6AA5"],
|
||||
"border_color": ["#3E454A", "#949A9F"],
|
||||
"hover_color": ["#3B8ED0", "#1F6AA5"],
|
||||
"checkmark_color": ["#DCE4EE", "gray90"],
|
||||
"text_color": ["gray10", "#DCE4EE"],
|
||||
"text_color_disabled": ["gray60", "gray45"]
|
||||
},
|
||||
"CTkSwitch": {
|
||||
"corner_radius": 1000,
|
||||
"border_width": 3,
|
||||
"button_length": 0,
|
||||
"fg_Color": ["#939BA2", "#4A4D50"],
|
||||
"progress_color": ["#3B8ED0", "#1F6AA5"],
|
||||
"button_color": ["gray36", "#D5D9DE"],
|
||||
"button_hover_color": ["gray20", "gray100"],
|
||||
"text_color": ["gray10", "#DCE4EE"],
|
||||
"text_color_disabled": ["gray60", "gray45"]
|
||||
},
|
||||
"CTkRadiobutton": {
|
||||
"corner_radius": 1000,
|
||||
"border_width_checked": 6,
|
||||
"border_width_unchecked": 3,
|
||||
"fg_color": ["#3B8ED0", "#1F6AA5"],
|
||||
"border_color": ["#3E454A", "#949A9F"],
|
||||
"hover_color": ["#36719F", "#144870"],
|
||||
"text_color": ["gray10", "#DCE4EE"],
|
||||
"text_color_disabled": ["gray60", "gray45"]
|
||||
},
|
||||
"CTkProgressBar": {
|
||||
"corner_radius": 1000,
|
||||
"border_width": 0,
|
||||
"fg_color": ["#939BA2", "#4A4D50"],
|
||||
"progress_color": ["#3B8ED0", "#1F6AA5"],
|
||||
"border_color": ["gray", "gray"]
|
||||
},
|
||||
"CTkSlider": {
|
||||
"corner_radius": 1000,
|
||||
"button_corner_radius": 1000,
|
||||
"border_width": 6,
|
||||
"button_length": 0,
|
||||
"fg_color": ["#939BA2", "#4A4D50"],
|
||||
"progress_color": ["gray40", "#AAB0B5"],
|
||||
"button_color": ["#3B8ED0", "#1F6AA5"],
|
||||
"button_hover_color": ["#36719F", "#144870"]
|
||||
},
|
||||
"CTkOptionMenu": {
|
||||
"corner_radius": 6,
|
||||
"fg_color": ["#3B8ED0", "#1F6AA5"],
|
||||
"button_color": ["#36719F", "#144870"],
|
||||
"button_hover_color": ["#27577D", "#203A4F"],
|
||||
"text_color": ["#DCE4EE", "#DCE4EE"],
|
||||
"text_color_disabled": ["gray74", "gray60"]
|
||||
},
|
||||
"CTkComboBox": {
|
||||
"corner_radius": 6,
|
||||
"border_width": 2,
|
||||
"fg_color": ["#F9F9FA", "#343638"],
|
||||
"border_color": ["#979DA2", "#565B5E"],
|
||||
"button_color": ["#979DA2", "#565B5E"],
|
||||
"button_hover_color": ["#6E7174", "#7A848D"],
|
||||
"text_color": ["gray10", "#DCE4EE"],
|
||||
"text_color_disabled": ["gray50", "gray45"]
|
||||
},
|
||||
"CTkScrollbar": {
|
||||
"corner_radius": 1000,
|
||||
"border_spacing": 4,
|
||||
"fg_color": "transparent",
|
||||
"button_color": ["#36719F", "#144870"],
|
||||
"button_hover_color": ["#27577D", "#203A4F"]
|
||||
},
|
||||
"CTkSegmentedButton": {
|
||||
"corner_radius": 6,
|
||||
"border_width": 2,
|
||||
"fg_color": ["#979DA2", "#4A4D50"],
|
||||
"selected_color": ["#3B8ED0", "#1F6AA5"],
|
||||
"selected_hover_color": ["#36719F", "#144870"],
|
||||
"unselected_color": ["#979DA2", "#4A4D50"],
|
||||
"unselected_hover_color": ["gray70", "gray41"],
|
||||
"text_color": ["#DCE4EE", "#DCE4EE"],
|
||||
"text_color_disabled": ["gray74", "gray60"]
|
||||
},
|
||||
"CTkTextbox": {
|
||||
"corner_radius": 6,
|
||||
"border_width": 0,
|
||||
"fg_color": ["#F9F9FA", "#343638"],
|
||||
"border_color": ["#979DA2", "#565B5E"],
|
||||
"text_color":["gray10", "#DCE4EE"],
|
||||
"scrollbar_button_color": ["gray55", "gray41"],
|
||||
"scrollbar_button_hover_color": ["gray40", "gray53"]
|
||||
},
|
||||
"DropdownMenu": {
|
||||
"fg_color": ["gray90", "gray20"],
|
||||
"hover_color": ["gray75", "gray28"],
|
||||
"text_color": ["#DCE4EE", "#DCE4EE"]
|
||||
},
|
||||
"CTkFont": {
|
||||
"macOS": {
|
||||
"font": "SF Display",
|
||||
"size": -13
|
||||
"family": "SF Display",
|
||||
"size": 13,
|
||||
"weight": "normal"
|
||||
},
|
||||
"Windows": {
|
||||
"font": "Roboto",
|
||||
"size": -13
|
||||
"family": "Roboto",
|
||||
"size": 13,
|
||||
"weight": "normal"
|
||||
},
|
||||
"Linux": {
|
||||
"font": "Roboto",
|
||||
"size": -13
|
||||
"family": "Roboto",
|
||||
"size": 13,
|
||||
"weight": "normal"
|
||||
}
|
||||
},
|
||||
"shape": {
|
||||
"button_corner_radius": 6,
|
||||
"button_border_width": 0,
|
||||
"checkbox_corner_radius": 6,
|
||||
"checkbox_border_width": 3,
|
||||
"radiobutton_corner_radius": 1000,
|
||||
"radiobutton_border_width_unchecked": 3,
|
||||
"radiobutton_border_width_checked": 6,
|
||||
"entry_border_width": 2,
|
||||
"frame_corner_radius": 6,
|
||||
"frame_border_width": 0,
|
||||
"label_corner_radius": 0,
|
||||
"progressbar_border_width": 0,
|
||||
"progressbar_corner_radius": 1000,
|
||||
"slider_border_width": 6,
|
||||
"slider_corner_radius": 1000,
|
||||
"slider_button_length": 0,
|
||||
"slider_button_corner_radius": 1000,
|
||||
"switch_border_width": 3,
|
||||
"switch_corner_radius": 1000,
|
||||
"switch_button_length": 0,
|
||||
"scrollbar_corner_radius": 1000,
|
||||
"scrollbar_border_spacing": 4
|
||||
}
|
||||
}
|
||||
|
82
customtkinter/assets/themes/blue_old.json
Normal file
82
customtkinter/assets/themes/blue_old.json
Normal file
@ -0,0 +1,82 @@
|
||||
{
|
||||
"color": {
|
||||
"window": ["#EBEBEC", "#212325"],
|
||||
"button": ["#3B8ED0", "#1F6AA5"],
|
||||
"button_hover": ["#36719F", "#144870"],
|
||||
"button_border": ["#3E454A", "#949A9F"],
|
||||
"checkbox_border": ["#3E454A", "#949A9F"],
|
||||
"checkmark": ["#DCE4EE", "gray90"],
|
||||
"entry": ["#F9F9FA", "#343638"],
|
||||
"entry_border": ["#979DA2", "#565B5E"],
|
||||
"entry_placeholder_text": ["gray52", "gray62"],
|
||||
"frame_border": ["#979DA2", "#565B5E"],
|
||||
"frame_low": ["#D1D5D8", "#2A2D2E"],
|
||||
"frame_high": ["#C0C2C5", "#343638"],
|
||||
"label": "transparent",
|
||||
"text": ["gray10", "#DCE4EE"],
|
||||
"text_disabled": ["gray60", "gray45"],
|
||||
"text_button": ["#DCE4EE", "#DCE4EE"],
|
||||
"text_button_disabled": ["gray74", "gray60"],
|
||||
"progressbar": ["#939BA2", "#4A4D50"],
|
||||
"progressbar_progress": ["#3B8ED0", "#1F6AA5"],
|
||||
"progressbar_border": ["gray", "gray"],
|
||||
"slider": ["#939BA2", "#4A4D50"],
|
||||
"slider_progress": ["gray40", "#AAB0B5"],
|
||||
"slider_button": ["#3B8ED0", "#1F6AA5"],
|
||||
"slider_button_hover": ["#36719F", "#144870"],
|
||||
"switch": ["#939BA2", "#4A4D50"],
|
||||
"switch_progress": ["#3B8ED0", "#1F6AA5"],
|
||||
"switch_button": ["gray36", "#D5D9DE"],
|
||||
"switch_button_hover": ["gray20", "gray100"],
|
||||
"optionmenu_button": ["#36719F", "#144870"],
|
||||
"optionmenu_button_hover": ["#27577D", "#203A4F"],
|
||||
"combobox_border": ["#979DA2", "#565B5E"],
|
||||
"combobox_button_hover": ["#6E7174", "#7A848D"],
|
||||
"dropdown_color": ["gray90", "gray20"],
|
||||
"dropdown_hover": ["gray75", "gray28"],
|
||||
"dropdown_text": ["gray10", "#DCE4EE"],
|
||||
"scrollbar_button": ["gray55", "gray41"],
|
||||
"scrollbar_button_hover": ["gray40", "gray53"],
|
||||
"segmented_button": ["#979DA2", "#4A4D50"],
|
||||
"segmented_button_unselected": ["#979DA2", "#4A4D50"],
|
||||
"segmented_button_unselected_hover": ["gray70", "gray41"]
|
||||
},
|
||||
"text": {
|
||||
"macOS": {
|
||||
"font": "SF Display",
|
||||
"size": -13
|
||||
},
|
||||
"Windows": {
|
||||
"font": "Roboto",
|
||||
"size": -13
|
||||
},
|
||||
"Linux": {
|
||||
"font": "Roboto",
|
||||
"size": -13
|
||||
}
|
||||
},
|
||||
"shape": {
|
||||
"button_corner_radius": 6,
|
||||
"button_border_width": 0,
|
||||
"checkbox_corner_radius": 6,
|
||||
"checkbox_border_width": 3,
|
||||
"radiobutton_corner_radius": 1000,
|
||||
"radiobutton_border_width_unchecked": 3,
|
||||
"radiobutton_border_width_checked": 6,
|
||||
"entry_border_width": 2,
|
||||
"frame_corner_radius": 6,
|
||||
"frame_border_width": 0,
|
||||
"label_corner_radius": 0,
|
||||
"progressbar_border_width": 0,
|
||||
"progressbar_corner_radius": 1000,
|
||||
"slider_border_width": 6,
|
||||
"slider_corner_radius": 1000,
|
||||
"slider_button_length": 0,
|
||||
"slider_button_corner_radius": 1000,
|
||||
"switch_border_width": 3,
|
||||
"switch_corner_radius": 1000,
|
||||
"switch_button_length": 0,
|
||||
"scrollbar_corner_radius": 1000,
|
||||
"scrollbar_border_spacing": 4
|
||||
}
|
||||
}
|
@ -48,7 +48,7 @@ class CTk(tkinter.Tk, CTkAppearanceModeBaseClass, CTkScalingBaseClass):
|
||||
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 is None else self._check_color_type(fg_color)
|
||||
self._fg_color = ThemeManager.theme["CTk"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
|
||||
# set bg of tkinter.Tk
|
||||
super().configure(bg=self._apply_appearance_mode(self._fg_color))
|
||||
|
@ -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 is None else self._check_color_type(fg_color)
|
||||
self._fg_color = ThemeManager.theme["CTkToplevel"]["fg_color"] 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))
|
||||
|
@ -27,9 +27,9 @@ class DropdownMenu(tkinter.Menu, CTkAppearanceModeBaseClass, CTkScalingBaseClass
|
||||
CTkScalingBaseClass.__init__(self, scaling_type="widget")
|
||||
|
||||
self._min_character_width = min_character_width
|
||||
self._fg_color = ThemeManager.theme["color"]["dropdown_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._hover_color = ThemeManager.theme["color"]["dropdown_hover"] if hover_color is None else self._check_color_type(hover_color)
|
||||
self._text_color = ThemeManager.theme["color"]["text"] if text_color is None else self._check_color_type(text_color)
|
||||
self._fg_color = ThemeManager.theme["DropdownMenu"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._hover_color = ThemeManager.theme["DropdownMenu"]["hover_color"] if hover_color is None else self._check_color_type(hover_color)
|
||||
self._text_color = ThemeManager.theme["DropdownMenu"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
|
||||
# font
|
||||
self._font = CTkFont() if font is None else self._check_font_type(font)
|
||||
|
@ -52,17 +52,17 @@ class CTkButton(CTkBaseClass):
|
||||
super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs)
|
||||
|
||||
# shape
|
||||
self._corner_radius: int = ThemeManager.theme["shape"]["button_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._corner_radius: int = ThemeManager.theme["CTkButton"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._corner_radius = min(self._corner_radius, round(self._current_height / 2))
|
||||
self._border_width: int = ThemeManager.theme["shape"]["button_border_width"] if border_width is None else border_width
|
||||
self._border_width: int = ThemeManager.theme["CTkButton"]["border_width"] if border_width is None else border_width
|
||||
self._border_spacing: int = border_spacing
|
||||
|
||||
# color
|
||||
self._fg_color: Union[str, Tuple[str, str]] = ThemeManager.theme["color"]["button"] if fg_color is None else self._check_color_type(fg_color, transparency=True)
|
||||
self._hover_color: Union[str, Tuple[str, str]] = ThemeManager.theme["color"]["button_hover"] if hover_color is None else self._check_color_type(hover_color)
|
||||
self._border_color: Union[str, Tuple[str, str]] = ThemeManager.theme["color"]["button_border"] if border_color is None else self._check_color_type(border_color)
|
||||
self._text_color: Union[str, Tuple[str, str]] = ThemeManager.theme["color"]["text_button"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled: Union[str, Tuple[str, str]] = ThemeManager.theme["color"]["text_button_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
self._fg_color: Union[str, Tuple[str, str]] = ThemeManager.theme["CTkButton"]["fg_color"] if fg_color is None else self._check_color_type(fg_color, transparency=True)
|
||||
self._hover_color: Union[str, Tuple[str, str]] = ThemeManager.theme["CTkButton"]["hover_color"] if hover_color is None else self._check_color_type(hover_color)
|
||||
self._border_color: Union[str, Tuple[str, str]] = ThemeManager.theme["CTkButton"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
self._text_color: Union[str, Tuple[str, str]] = ThemeManager.theme["CTkButton"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled: Union[str, Tuple[str, str]] = ThemeManager.theme["CTkButton"]["text_color_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
|
||||
# rendering options
|
||||
self._background_corner_colors: Union[Tuple[Union[str, Tuple[str, str]]], None] = background_corner_colors # rendering options for DrawEngine
|
||||
|
@ -51,20 +51,20 @@ class CTkCheckBox(CTkBaseClass):
|
||||
self._checkbox_height = checkbox_height
|
||||
|
||||
# color
|
||||
self._fg_color = ThemeManager.theme["color"]["button"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._hover_color = ThemeManager.theme["color"]["button_hover"] if hover_color is None else self._check_color_type(hover_color)
|
||||
self._border_color = ThemeManager.theme["color"]["checkbox_border"] if border_color is None else self._check_color_type(border_color)
|
||||
self._checkmark_color = ThemeManager.theme["color"]["checkmark"] if checkmark_color is None else self._check_color_type(checkmark_color)
|
||||
self._fg_color = ThemeManager.theme["CTkCheckbox"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._hover_color = ThemeManager.theme["CTkCheckbox"]["hover_color"] if hover_color is None else self._check_color_type(hover_color)
|
||||
self._border_color = ThemeManager.theme["CTkCheckbox"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
self._checkmark_color = ThemeManager.theme["CTkCheckbox"]["checkmark_color"] if checkmark_color is None else self._check_color_type(checkmark_color)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["checkbox_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["shape"]["checkbox_border_width"] if border_width is None else border_width
|
||||
self._corner_radius = ThemeManager.theme["CTkCheckbox"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["CTkCheckbox"]["border_width"] if border_width is None else border_width
|
||||
|
||||
# text
|
||||
self._text = text
|
||||
self._text_label: Union[tkinter.Label, None] = None
|
||||
self._text_color = ThemeManager.theme["color"]["text"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["color"]["text_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
self._text_color = ThemeManager.theme["CTkCheckbox"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["CTkCheckbox"]["text_color_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
|
||||
# font
|
||||
self._font = CTkFont() if font is None else self._check_font_type(font)
|
||||
|
@ -48,16 +48,16 @@ class CTkComboBox(CTkBaseClass):
|
||||
super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["button_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["shape"]["entry_border_width"] if border_width is None else border_width
|
||||
self._corner_radius = ThemeManager.theme["CTkComboBox"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["CTkComboBox"]["border_width"] if border_width is None else border_width
|
||||
|
||||
# color
|
||||
self._fg_color = ThemeManager.theme["color"]["entry"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._border_color = ThemeManager.theme["color"]["combobox_border"] if border_color is None else self._check_color_type(border_color)
|
||||
self._button_color = ThemeManager.theme["color"]["combobox_border"] if button_color is None else self._check_color_type(button_color)
|
||||
self._button_hover_color = ThemeManager.theme["color"]["combobox_button_hover"] if button_hover_color is None else self._check_color_type(button_hover_color)
|
||||
self._text_color = ThemeManager.theme["color"]["text"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["color"]["text_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
self._fg_color = ThemeManager.theme["CTkComboBox"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._border_color = ThemeManager.theme["CTkComboBox"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
self._button_color = ThemeManager.theme["CTkComboBox"]["button_color"] if button_color is None else self._check_color_type(button_color)
|
||||
self._button_hover_color = ThemeManager.theme["CTkComboBox"]["button_hover_color"] if button_hover_color is None else self._check_color_type(button_hover_color)
|
||||
self._text_color = ThemeManager.theme["CTkComboBox"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["CTkComboBox"]["text_color_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
|
||||
# font
|
||||
self._font = CTkFont() if font is None else self._check_font_type(font)
|
||||
@ -189,11 +189,11 @@ class CTkComboBox(CTkBaseClass):
|
||||
outline=self._apply_appearance_mode(self._border_color),
|
||||
fill=self._apply_appearance_mode(self._border_color))
|
||||
self._canvas.itemconfig("inner_parts_right",
|
||||
outline=self._apply_appearance_mode(self._border_color),
|
||||
fill=self._apply_appearance_mode(self._border_color))
|
||||
outline=self._apply_appearance_mode(self._button_color),
|
||||
fill=self._apply_appearance_mode(self._button_color))
|
||||
self._canvas.itemconfig("border_parts_right",
|
||||
outline=self._apply_appearance_mode(self._border_color),
|
||||
fill=self._apply_appearance_mode(self._border_color))
|
||||
outline=self._apply_appearance_mode(self._button_color),
|
||||
fill=self._apply_appearance_mode(self._button_color))
|
||||
|
||||
self._entry.configure(bg=self._apply_appearance_mode(self._fg_color),
|
||||
fg=self._apply_appearance_mode(self._text_color),
|
||||
|
@ -50,14 +50,14 @@ class CTkEntry(CTkBaseClass):
|
||||
self.grid_columnconfigure(0, weight=1)
|
||||
|
||||
# color
|
||||
self._fg_color = ThemeManager.theme["color"]["entry"] if fg_color is None else self._check_color_type(fg_color, transparency=True)
|
||||
self._text_color = ThemeManager.theme["color"]["text"] if text_color is None else self._check_color_type(text_color)
|
||||
self._placeholder_text_color = ThemeManager.theme["color"]["entry_placeholder_text"] if placeholder_text_color is None else self._check_color_type(placeholder_text_color)
|
||||
self._border_color = ThemeManager.theme["color"]["entry_border"] if border_color is None else self._check_color_type(border_color)
|
||||
self._fg_color = ThemeManager.theme["CTkEntry"]["fg_color"] if fg_color is None else self._check_color_type(fg_color, transparency=True)
|
||||
self._text_color = ThemeManager.theme["CTkEntry"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._placeholder_text_color = ThemeManager.theme["CTkEntry"]["placeholder_text_color"] if placeholder_text_color is None else self._check_color_type(placeholder_text_color)
|
||||
self._border_color = ThemeManager.theme["CTkEntry"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["button_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["shape"]["entry_border_width"] if border_width is None else border_width
|
||||
self._corner_radius = ThemeManager.theme["CTkEntry"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["CTkEntry"]["border_width"] if border_width is None else border_width
|
||||
|
||||
# text and state
|
||||
self._is_focused: bool = True
|
||||
|
@ -33,25 +33,25 @@ class CTkFrame(CTkBaseClass):
|
||||
super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs)
|
||||
|
||||
# color
|
||||
self._border_color = ThemeManager.theme["color"]["frame_border"] if border_color is None else self._check_color_type(border_color)
|
||||
self._border_color = ThemeManager.theme["CTkFrame"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
|
||||
# determine fg_color of frame
|
||||
if fg_color is None:
|
||||
if isinstance(self.master, CTkFrame):
|
||||
if self.master._fg_color == ThemeManager.theme["color"]["frame_low"]:
|
||||
self._fg_color = ThemeManager.theme["color"]["frame_high"]
|
||||
if self.master._fg_color == ThemeManager.theme["CTkFrame"]["fg_color"]:
|
||||
self._fg_color = ThemeManager.theme["CTkFrame"]["top_fg_color"]
|
||||
else:
|
||||
self._fg_color = ThemeManager.theme["color"]["frame_low"]
|
||||
self._fg_color = ThemeManager.theme["CTkFrame"]["fg_color"]
|
||||
else:
|
||||
self._fg_color = ThemeManager.theme["color"]["frame_low"]
|
||||
self._fg_color = ThemeManager.theme["CTkFrame"]["fg_color"]
|
||||
else:
|
||||
self._fg_color = self._check_color_type(fg_color, transparency=True)
|
||||
|
||||
self._background_corner_colors = background_corner_colors # rendering options for DrawEngine
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["frame_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["shape"]["frame_border_width"] if border_width is None else border_width
|
||||
self._corner_radius = ThemeManager.theme["CTkFrame"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["CTkFrame"]["border_width"] if border_width is None else border_width
|
||||
|
||||
self._canvas = CTkCanvas(master=self,
|
||||
highlightthickness=0,
|
||||
|
@ -43,11 +43,11 @@ class CTkLabel(CTkBaseClass):
|
||||
super().__init__(master=master, bg_color=bg_color, width=width, height=height)
|
||||
|
||||
# color
|
||||
self._fg_color = ThemeManager.theme["color"]["label"] if fg_color is None else self._check_color_type(fg_color, transparency=True)
|
||||
self._text_color = ThemeManager.theme["color"]["text"] if text_color is None else self._check_color_type(text_color)
|
||||
self._fg_color = ThemeManager.theme["CTkLabel"]["fg_color"] if fg_color is None else self._check_color_type(fg_color, transparency=True)
|
||||
self._text_color = ThemeManager.theme["CTkLabel"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["label_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._corner_radius = ThemeManager.theme["CTkLabel"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
|
||||
# text
|
||||
self._anchor = anchor
|
||||
|
@ -47,16 +47,16 @@ class CTkOptionMenu(CTkBaseClass):
|
||||
super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs)
|
||||
|
||||
# color variables
|
||||
self._fg_color = ThemeManager.theme["color"]["button"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._button_color = ThemeManager.theme["color"]["optionmenu_button"] if button_color is None else self._check_color_type(button_color)
|
||||
self._button_hover_color = ThemeManager.theme["color"]["optionmenu_button_hover"] if button_hover_color is None else self._check_color_type(button_hover_color)
|
||||
self._fg_color = ThemeManager.theme["CTkOptionMenu"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._button_color = ThemeManager.theme["CTkOptionMenu"]["button_color"] if button_color is None else self._check_color_type(button_color)
|
||||
self._button_hover_color = ThemeManager.theme["CTkOptionMenu"]["button_hover_color"] if button_hover_color is None else self._check_color_type(button_hover_color)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["button_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._corner_radius = ThemeManager.theme["CTkOptionMenu"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
|
||||
# text and font
|
||||
self._text_color = ThemeManager.theme["color"]["text_button"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["color"]["text_button_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
self._text_color = ThemeManager.theme["CTkOptionMenu"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["CTkOptionMenu"]["text_color_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
|
||||
# font
|
||||
self._font = CTkFont() if font is None else self._check_font_type(font)
|
||||
|
@ -50,9 +50,9 @@ class CTkProgressBar(CTkBaseClass):
|
||||
super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs)
|
||||
|
||||
# color
|
||||
self._border_color = ThemeManager.theme["color"]["progressbar_border"] if border_color is None else self._check_color_type(border_color)
|
||||
self._fg_color = ThemeManager.theme["color"]["progressbar"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._progress_color = ThemeManager.theme["color"]["progressbar_progress"] if progress_color is None else self._check_color_type(progress_color)
|
||||
self._border_color = ThemeManager.theme["CTkProgressBar"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
self._fg_color = ThemeManager.theme["CTkProgressBar"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._progress_color = ThemeManager.theme["CTkProgressBar"]["progress_color"] if progress_color is None else self._check_color_type(progress_color)
|
||||
|
||||
# control variable
|
||||
self._variable = variable
|
||||
@ -60,8 +60,8 @@ class CTkProgressBar(CTkBaseClass):
|
||||
self._variable_callback_name = None
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["progressbar_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["shape"]["progressbar_border_width"] if border_width is None else border_width
|
||||
self._corner_radius = ThemeManager.theme["CTkProgressBar"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["CTkProgressBar"]["border_width"] if border_width is None else border_width
|
||||
self._determinate_value: float = 0.5 # range 0-1
|
||||
self._determinate_speed = determinate_speed # range 0-1
|
||||
self._indeterminate_value: float = 0 # range 0-inf
|
||||
|
@ -50,20 +50,20 @@ class CTkRadioButton(CTkBaseClass):
|
||||
self._radiobutton_height = radiobutton_height
|
||||
|
||||
# color
|
||||
self._fg_color = ThemeManager.theme["color"]["button"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._hover_color = ThemeManager.theme["color"]["button_hover"] if hover_color is None else self._check_color_type(hover_color)
|
||||
self._border_color = ThemeManager.theme["color"]["checkbox_border"] if border_color is None else self._check_color_type(border_color)
|
||||
self._fg_color = ThemeManager.theme["CTkRadiobutton"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._hover_color = ThemeManager.theme["CTkRadiobutton"]["hover_color"] if hover_color is None else self._check_color_type(hover_color)
|
||||
self._border_color = ThemeManager.theme["CTkRadiobutton"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["radiobutton_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width_unchecked = ThemeManager.theme["shape"]["radiobutton_border_width_unchecked"] if border_width_unchecked is None else border_width_unchecked
|
||||
self._border_width_checked = ThemeManager.theme["shape"]["radiobutton_border_width_checked"] if border_width_checked is None else border_width_checked
|
||||
self._corner_radius = ThemeManager.theme["CTkRadiobutton"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width_unchecked = ThemeManager.theme["CTkRadiobutton"]["border_width_unchecked"] if border_width_unchecked is None else border_width_unchecked
|
||||
self._border_width_checked = ThemeManager.theme["CTkRadiobutton"]["border_width_checked"] if border_width_checked is None else border_width_checked
|
||||
|
||||
# text
|
||||
self._text = text
|
||||
self._text_label: Union[tkinter.Label, None] = None
|
||||
self._text_color = ThemeManager.theme["color"]["text"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["color"]["text_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
self._text_color = ThemeManager.theme["CTkRadiobutton"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["CTkRadiobutton"]["text_color_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
|
||||
# font
|
||||
self._font = CTkFont() if font is None else self._check_font_type(font)
|
||||
|
@ -24,8 +24,8 @@ class CTkScrollbar(CTkBaseClass):
|
||||
|
||||
bg_color: Union[str, Tuple[str, str]] = "transparent",
|
||||
fg_color: Optional[Union[str, Tuple[str, str]]] = None,
|
||||
scrollbar_color: Optional[Union[str, Tuple[str, str]]] = None,
|
||||
scrollbar_hover_color: Optional[Union[str, Tuple[str, str]]] = None,
|
||||
button_color: Optional[Union[str, Tuple[str, str]]] = None,
|
||||
button_hover_color: Optional[Union[str, Tuple[str, str]]] = None,
|
||||
|
||||
hover: bool = True,
|
||||
command: Union[Callable, None] = None,
|
||||
@ -48,13 +48,13 @@ class CTkScrollbar(CTkBaseClass):
|
||||
super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs)
|
||||
|
||||
# color
|
||||
self._fg_color = ThemeManager.theme["color"]["frame_high"] if fg_color is None else self._check_color_type(fg_color, transparency=True)
|
||||
self._scrollbar_color = ThemeManager.theme["color"]["scrollbar_button"] if scrollbar_color is None else self._check_color_type(scrollbar_color)
|
||||
self._scrollbar_hover_color = ThemeManager.theme["color"]["scrollbar_button_hover"] if scrollbar_hover_color is None else self._check_color_type(scrollbar_hover_color)
|
||||
self._fg_color = ThemeManager.theme["CTkScrollbar"]["fg_color"] if fg_color is None else self._check_color_type(fg_color, transparency=True)
|
||||
self._button_color = ThemeManager.theme["CTkScrollbar"]["scrollbar_color"] if button_color is None else self._check_color_type(button_color)
|
||||
self._button_hover_color = ThemeManager.theme["CTkScrollbar"]["scrollbar_hover_color"] if button_hover_color is None else self._check_color_type(button_hover_color)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["scrollbar_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_spacing = ThemeManager.theme["shape"]["scrollbar_border_spacing"] if border_spacing is None else border_spacing
|
||||
self._corner_radius = ThemeManager.theme["CTkScrollbar"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_spacing = ThemeManager.theme["CTkScrollbar"]["border_spacing"] if border_spacing is None else border_spacing
|
||||
|
||||
self._hover = hover
|
||||
self._hover_state: bool = False
|
||||
@ -132,12 +132,12 @@ class CTkScrollbar(CTkBaseClass):
|
||||
if no_color_updates is False or requires_recoloring:
|
||||
if self._hover_state is True:
|
||||
self._canvas.itemconfig("scrollbar_parts",
|
||||
fill=self._apply_appearance_mode(self._scrollbar_hover_color),
|
||||
outline=self._apply_appearance_mode(self._scrollbar_hover_color))
|
||||
fill=self._apply_appearance_mode(self._button_hover_color),
|
||||
outline=self._apply_appearance_mode(self._button_hover_color))
|
||||
else:
|
||||
self._canvas.itemconfig("scrollbar_parts",
|
||||
fill=self._apply_appearance_mode(self._scrollbar_color),
|
||||
outline=self._apply_appearance_mode(self._scrollbar_color))
|
||||
fill=self._apply_appearance_mode(self._button_color),
|
||||
outline=self._apply_appearance_mode(self._button_color))
|
||||
|
||||
if self._fg_color == "transparent":
|
||||
self._canvas.configure(bg=self._apply_appearance_mode(self._bg_color))
|
||||
@ -157,12 +157,12 @@ class CTkScrollbar(CTkBaseClass):
|
||||
self._fg_color = self._check_color_type(kwargs.pop("fg_color"), transparency=True)
|
||||
require_redraw = True
|
||||
|
||||
if "scrollbar_color" in kwargs:
|
||||
self._scrollbar_color = self._check_color_type(kwargs.pop("scrollbar_color"))
|
||||
if "button_color" in kwargs:
|
||||
self._button_color = self._check_color_type(kwargs.pop("button_color"))
|
||||
require_redraw = True
|
||||
|
||||
if "scrollbar_hover_color" in kwargs:
|
||||
self._scrollbar_hover_color = self._check_color_type(kwargs.pop("scrollbar_hover_color"))
|
||||
if "button_hover_color" in kwargs:
|
||||
self._button_hover_color = self._check_color_type(kwargs.pop("button_hover_color"))
|
||||
require_redraw = True
|
||||
|
||||
if "hover" in kwargs:
|
||||
@ -192,9 +192,9 @@ class CTkScrollbar(CTkBaseClass):
|
||||
elif attribute_name == "fg_color":
|
||||
return self._fg_color
|
||||
elif attribute_name == "scrollbar_color":
|
||||
return self._scrollbar_color
|
||||
return self._button_color
|
||||
elif attribute_name == "scrollbar_hover_color":
|
||||
return self._scrollbar_hover_color
|
||||
return self._button_hover_color
|
||||
|
||||
elif attribute_name == "hover":
|
||||
return self._hover
|
||||
@ -210,14 +210,14 @@ class CTkScrollbar(CTkBaseClass):
|
||||
if self._hover is True:
|
||||
self._hover_state = True
|
||||
self._canvas.itemconfig("scrollbar_parts",
|
||||
outline=self._apply_appearance_mode(self._scrollbar_hover_color),
|
||||
fill=self._apply_appearance_mode(self._scrollbar_hover_color))
|
||||
outline=self._apply_appearance_mode(self._button_hover_color),
|
||||
fill=self._apply_appearance_mode(self._button_hover_color))
|
||||
|
||||
def _on_leave(self, event=0):
|
||||
self._hover_state = False
|
||||
self._canvas.itemconfig("scrollbar_parts",
|
||||
outline=self._apply_appearance_mode(self._scrollbar_color),
|
||||
fill=self._apply_appearance_mode(self._scrollbar_color))
|
||||
outline=self._apply_appearance_mode(self._button_color),
|
||||
fill=self._apply_appearance_mode(self._button_color))
|
||||
|
||||
def _clicked(self, event):
|
||||
if self._orientation == "vertical":
|
||||
|
@ -40,24 +40,24 @@ class CTkSegmentedButton(CTkFrame):
|
||||
|
||||
super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs)
|
||||
|
||||
self._sb_fg_color = ThemeManager.theme["color"]["segmented_button"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._sb_fg_color = ThemeManager.theme["CTkSegmentedButton"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
|
||||
self._sb_selected_color = ThemeManager.theme["color"]["button"] if selected_color is None else self._check_color_type(selected_color)
|
||||
self._sb_selected_hover_color = ThemeManager.theme["color"]["button_hover"] if selected_hover_color is None else self._check_color_type(selected_hover_color)
|
||||
self._sb_selected_color = ThemeManager.theme["CTkSegmentedButton"]["selected_color"] if selected_color is None else self._check_color_type(selected_color)
|
||||
self._sb_selected_hover_color = ThemeManager.theme["CTkSegmentedButton"]["selected_hover_color"] if selected_hover_color is None else self._check_color_type(selected_hover_color)
|
||||
|
||||
self._sb_unselected_color = ThemeManager.theme["color"]["segmented_button_unselected"] if unselected_color is None else self._check_color_type(unselected_color)
|
||||
self._sb_unselected_hover_color = ThemeManager.theme["color"]["segmented_button_unselected_hover"] if unselected_hover_color is None else self._check_color_type(unselected_hover_color)
|
||||
self._sb_unselected_color = ThemeManager.theme["CTkSegmentedButton"]["unselected_color"] if unselected_color is None else self._check_color_type(unselected_color)
|
||||
self._sb_unselected_hover_color = ThemeManager.theme["CTkSegmentedButton"]["unselected_hover_color"] if unselected_hover_color is None else self._check_color_type(unselected_hover_color)
|
||||
|
||||
self._sb_text_color = ThemeManager.theme["color"]["text_button"] if text_color is None else self._check_color_type(text_color)
|
||||
self._sb_text_color_disabled = ThemeManager.theme["color"]["text_button_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
self._sb_text_color = ThemeManager.theme["CTkSegmentedButton"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._sb_text_color_disabled = ThemeManager.theme["CTkSegmentedButton"]["text_color_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
|
||||
self._sb_corner_radius = ThemeManager.theme["shape"]["button_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._sb_border_width = ThemeManager.theme["shape"]["button_border_width"] if border_width is None else border_width
|
||||
self._sb_corner_radius = ThemeManager.theme["CTkSegmentedButton"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._sb_border_width = ThemeManager.theme["CTkSegmentedButton"]["border_width"] if border_width is None else border_width
|
||||
|
||||
self._background_corner_colors = background_corner_colors # rendering options for DrawEngine
|
||||
|
||||
self._command: Callable[[str], None] = command
|
||||
self._font = (ThemeManager.theme["text"]["font"], ThemeManager.theme["text"]["size"]) if font is None else font
|
||||
self._font = CTkFont() if font is None else font
|
||||
self._state = state
|
||||
|
||||
self._buttons_dict: Dict[str, CTkButton] = {} # mapped from value to button object
|
||||
|
@ -57,16 +57,16 @@ class CTkSlider(CTkBaseClass):
|
||||
|
||||
# color
|
||||
self._border_color = self._check_color_type(border_color, transparency=True)
|
||||
self._fg_color = ThemeManager.theme["color"]["slider"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._progress_color = ThemeManager.theme["color"]["slider_progress"] if progress_color is None else self._check_color_type(progress_color, transparency=True)
|
||||
self._button_color = ThemeManager.theme["color"]["slider_button"] if button_color is None else self._check_color_type(button_color)
|
||||
self._button_hover_color = ThemeManager.theme["color"]["slider_button_hover"] if button_hover_color is None else self._check_color_type(button_hover_color)
|
||||
self._fg_color = ThemeManager.theme["CTkSlider"]["fg_color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._progress_color = ThemeManager.theme["CTkSlider"]["progress_color"] if progress_color is None else self._check_color_type(progress_color, transparency=True)
|
||||
self._button_color = ThemeManager.theme["CTkSlider"]["button_color"] if button_color is None else self._check_color_type(button_color)
|
||||
self._button_hover_color = ThemeManager.theme["CTkSlider"]["button_hover_color"] if button_hover_color is None else self._check_color_type(button_hover_color)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["slider_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._button_corner_radius = ThemeManager.theme["shape"]["slider_button_corner_radius"] if button_corner_radius is None else button_corner_radius
|
||||
self._border_width = ThemeManager.theme["shape"]["slider_border_width"] if border_width is None else border_width
|
||||
self._button_length = ThemeManager.theme["shape"]["slider_button_length"] if button_length is None else button_length
|
||||
self._corner_radius = ThemeManager.theme["CTkSlider"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._button_corner_radius = ThemeManager.theme["CTkSlider"]["button_corner_radius"] if button_corner_radius is None else button_corner_radius
|
||||
self._border_width = ThemeManager.theme["CTkSlider"]["border_width"] if border_width is None else border_width
|
||||
self._button_length = ThemeManager.theme["CTkSlider"]["button_length"] if button_length is None else button_length
|
||||
self._value: float = 0.5 # initial value of slider in percent
|
||||
self._orientation = orientation
|
||||
self._hover_state: bool = False
|
||||
|
@ -54,12 +54,12 @@ class CTkSwitch(CTkBaseClass):
|
||||
|
||||
# color
|
||||
self._border_color = self._check_color_type(border_color, transparency=True)
|
||||
self._fg_color = ThemeManager.theme["color"]["switch"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._progress_color = ThemeManager.theme["color"]["switch_progress"] if progress_color is None else self._check_color_type(progress_color, transparency=True)
|
||||
self._button_color = ThemeManager.theme["color"]["switch_button"] if button_color is None else self._check_color_type(button_color)
|
||||
self._button_hover_color = ThemeManager.theme["color"]["switch_button_hover"] if button_hover_color is None else self._check_color_type(button_hover_color)
|
||||
self._text_color = ThemeManager.theme["color"]["text"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["color"]["text_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
self._fg_color = ThemeManager.theme["CTkSwitch"]["fg_Color"] if fg_color is None else self._check_color_type(fg_color)
|
||||
self._progress_color = ThemeManager.theme["CTkSwitch"]["progress_color"] if progress_color is None else self._check_color_type(progress_color, transparency=True)
|
||||
self._button_color = ThemeManager.theme["CTkSwitch"]["button_color"] if button_color is None else self._check_color_type(button_color)
|
||||
self._button_hover_color = ThemeManager.theme["CTkSwitch"]["button_hover_color"] if button_hover_color is None else self._check_color_type(button_hover_color)
|
||||
self._text_color = ThemeManager.theme["CTkSwitch"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._text_color_disabled = ThemeManager.theme["CTkSwitch"]["text_color_disabled"] if text_color_disabled is None else self._check_color_type(text_color_disabled)
|
||||
|
||||
# text
|
||||
self._text = text
|
||||
@ -71,9 +71,9 @@ class CTkSwitch(CTkBaseClass):
|
||||
self._font.add_size_configure_callback(self._update_font)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["switch_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["shape"]["switch_border_width"] if border_width is None else border_width
|
||||
self._button_length = ThemeManager.theme["shape"]["switch_button_length"] if button_length is None else button_length
|
||||
self._corner_radius = ThemeManager.theme["CTkSwitch"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["CTkSwitch"]["border_width"] if border_width is None else border_width
|
||||
self._button_length = ThemeManager.theme["CTkSwitch"]["button_length"] if button_length is None else button_length
|
||||
self._hover_state: bool = False
|
||||
self._check_state: bool = False # True if switch is activated
|
||||
self._hover = hover
|
||||
|
@ -48,23 +48,23 @@ class CTkTabview(CTkBaseClass):
|
||||
super().__init__(master=master, bg_color=bg_color, width=width, height=height, **kwargs)
|
||||
|
||||
# color
|
||||
self._border_color = ThemeManager.theme["color"]["frame_border"] if border_color is None else self._check_color_type(border_color)
|
||||
self._border_color = ThemeManager.theme["CTkFrame"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
|
||||
# determine fg_color of frame
|
||||
if fg_color is None:
|
||||
if isinstance(self.master, (CTkFrame, CTkTabview)):
|
||||
if self.master.cget("fg_color") == ThemeManager.theme["color"]["frame_low"]:
|
||||
self._fg_color = ThemeManager.theme["color"]["frame_high"]
|
||||
if self.master.cget("fg_color") == ThemeManager.theme["CTkFrame"]["fg_color"]:
|
||||
self._fg_color = ThemeManager.theme["CTkFrame"]["top_fg_color"]
|
||||
else:
|
||||
self._fg_color = ThemeManager.theme["color"]["frame_low"]
|
||||
self._fg_color = ThemeManager.theme["CTkFrame"]["fg_color"]
|
||||
else:
|
||||
self._fg_color = ThemeManager.theme["color"]["frame_low"]
|
||||
self._fg_color = ThemeManager.theme["CTkFrame"]["fg_color"]
|
||||
else:
|
||||
self._fg_color = self._check_color_type(fg_color, transparency=True)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["frame_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["shape"]["frame_border_width"] if border_width is None else border_width
|
||||
self._corner_radius = ThemeManager.theme["CTkFrame"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["CTkFrame"]["border_width"] if border_width is None else border_width
|
||||
|
||||
self._canvas = CTkCanvas(master=self,
|
||||
bg=self._apply_appearance_mode(self._bg_color),
|
||||
|
@ -44,8 +44,8 @@ class CTkTextbox(CTkBaseClass):
|
||||
fg_color: Optional[Union[str, Tuple[str, str]]] = None,
|
||||
border_color: Optional[Union[str, Tuple[str, str]]] = None,
|
||||
text_color: Optional[Union[str, str]] = None,
|
||||
scrollbar_color: Optional[Union[str, Tuple[str, str]]] = None,
|
||||
scrollbar_hover_color: Optional[Union[str, Tuple[str, str]]] = None,
|
||||
scrollbar_button_color: Optional[Union[str, Tuple[str, str]]] = None,
|
||||
scrollbar_button_hover_color: Optional[Union[str, Tuple[str, str]]] = None,
|
||||
|
||||
font: Optional[Union[tuple, CTkFont]] = None,
|
||||
activate_scrollbars: bool = True,
|
||||
@ -55,15 +55,15 @@ class CTkTextbox(CTkBaseClass):
|
||||
super().__init__(master=master, bg_color=bg_color, width=width, height=height)
|
||||
|
||||
# color
|
||||
self._fg_color = ThemeManager.theme["color"]["entry"] if fg_color is None else self._check_color_type(fg_color, transparency=True)
|
||||
self._border_color = ThemeManager.theme["color"]["frame_border"] if border_color is None else self._check_color_type(border_color)
|
||||
self._text_color = ThemeManager.theme["color"]["text"] if text_color is None else self._check_color_type(text_color)
|
||||
self._scrollbar_color = ThemeManager.theme["color"]["scrollbar_button"] if scrollbar_color is None else self._check_color_type(scrollbar_color)
|
||||
self._scrollbar_hover_color = ThemeManager.theme["color"]["scrollbar_button_hover"] if scrollbar_hover_color is None else self._check_color_type(scrollbar_hover_color)
|
||||
self._fg_color = ThemeManager.theme["CTkTextbox"]["fg_color"] if fg_color is None else self._check_color_type(fg_color, transparency=True)
|
||||
self._border_color = ThemeManager.theme["CTkTextbox"]["border_color"] if border_color is None else self._check_color_type(border_color)
|
||||
self._text_color = ThemeManager.theme["CTkTextbox"]["text_color"] if text_color is None else self._check_color_type(text_color)
|
||||
self._scrollbar_button_color = ThemeManager.theme["CTkTextbox"]["scrollbar_button_color"] if scrollbar_button_color is None else self._check_color_type(scrollbar_button_color)
|
||||
self._scrollbar_button_hover_color = ThemeManager.theme["CTkTextbox"]["scrollbar_button_hover_color"] if scrollbar_button_hover_color is None else self._check_color_type(scrollbar_button_hover_color)
|
||||
|
||||
# shape
|
||||
self._corner_radius = ThemeManager.theme["shape"]["frame_corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["shape"]["frame_border_width"] if border_width is None else border_width
|
||||
self._corner_radius = ThemeManager.theme["CTkTextbox"]["corner_radius"] if corner_radius is None else corner_radius
|
||||
self._border_width = ThemeManager.theme["CTkTextbox"]["border_width"] if border_width is None else border_width
|
||||
self._border_spacing = border_spacing
|
||||
|
||||
# font
|
||||
@ -102,8 +102,8 @@ class CTkTextbox(CTkBaseClass):
|
||||
height=0,
|
||||
border_spacing=0,
|
||||
fg_color=self._fg_color,
|
||||
scrollbar_color=self._scrollbar_color,
|
||||
scrollbar_hover_color=self._scrollbar_hover_color,
|
||||
button_color=self._scrollbar_button_color,
|
||||
button_hover_color=self._scrollbar_button_hover_color,
|
||||
orientation="vertical",
|
||||
command=self._textbox.yview)
|
||||
self._textbox.configure(yscrollcommand=self._y_scrollbar.set)
|
||||
@ -113,8 +113,8 @@ class CTkTextbox(CTkBaseClass):
|
||||
width=0,
|
||||
border_spacing=0,
|
||||
fg_color=self._fg_color,
|
||||
scrollbar_color=self._scrollbar_color,
|
||||
scrollbar_hover_color=self._scrollbar_hover_color,
|
||||
button_color=self._scrollbar_button_color,
|
||||
button_hover_color=self._scrollbar_button_hover_color,
|
||||
orientation="horizontal",
|
||||
command=self._textbox.xview)
|
||||
self._textbox.configure(xscrollcommand=self._x_scrollbar.set)
|
||||
@ -228,10 +228,10 @@ class CTkTextbox(CTkBaseClass):
|
||||
self._textbox.configure(fg=self._apply_appearance_mode(self._text_color),
|
||||
bg=self._apply_appearance_mode(self._bg_color),
|
||||
insertbackground=self._apply_appearance_mode(self._text_color))
|
||||
self._x_scrollbar.configure(fg_color=self._bg_color, scrollbar_color=self._scrollbar_color,
|
||||
scrollbar_hover_color=self._scrollbar_hover_color)
|
||||
self._y_scrollbar.configure(fg_color=self._bg_color, scrollbar_color=self._scrollbar_color,
|
||||
scrollbar_hover_color=self._scrollbar_hover_color)
|
||||
self._x_scrollbar.configure(fg_color=self._bg_color, scrollbar_color=self._scrollbar_button_color,
|
||||
scrollbar_hover_color=self._scrollbar_button_hover_color)
|
||||
self._y_scrollbar.configure(fg_color=self._bg_color, scrollbar_color=self._scrollbar_button_color,
|
||||
scrollbar_hover_color=self._scrollbar_button_hover_color)
|
||||
else:
|
||||
self._canvas.itemconfig("inner_parts",
|
||||
fill=self._apply_appearance_mode(self._fg_color),
|
||||
@ -239,10 +239,10 @@ class CTkTextbox(CTkBaseClass):
|
||||
self._textbox.configure(fg=self._apply_appearance_mode(self._text_color),
|
||||
bg=self._apply_appearance_mode(self._fg_color),
|
||||
insertbackground=self._apply_appearance_mode(self._text_color))
|
||||
self._x_scrollbar.configure(fg_color=self._fg_color, scrollbar_color=self._scrollbar_color,
|
||||
scrollbar_hover_color=self._scrollbar_hover_color)
|
||||
self._y_scrollbar.configure(fg_color=self._fg_color, scrollbar_color=self._scrollbar_color,
|
||||
scrollbar_hover_color=self._scrollbar_hover_color)
|
||||
self._x_scrollbar.configure(fg_color=self._fg_color, button_color=self._scrollbar_button_color,
|
||||
button_hover_color=self._scrollbar_button_hover_color)
|
||||
self._y_scrollbar.configure(fg_color=self._fg_color, button_color=self._scrollbar_button_color,
|
||||
button_hover_color=self._scrollbar_button_hover_color)
|
||||
|
||||
self._canvas.itemconfig("border_parts",
|
||||
fill=self._apply_appearance_mode(self._border_color),
|
||||
@ -270,15 +270,15 @@ class CTkTextbox(CTkBaseClass):
|
||||
self._text_color = self._check_color_type(kwargs.pop("text_color"))
|
||||
require_redraw = True
|
||||
|
||||
if "scrollbar_color" in kwargs:
|
||||
self._scrollbar_color = self._check_color_type(kwargs.pop("scrollbar_color"))
|
||||
self._x_scrollbar.configure(scrollbar_color=self._scrollbar_color)
|
||||
self._y_scrollbar.configure(scrollbar_color=self._scrollbar_color)
|
||||
if "scrollbar_button_color" in kwargs:
|
||||
self._scrollbar_button_color = self._check_color_type(kwargs.pop("scrollbar_button_color"))
|
||||
self._x_scrollbar.configure(button_color=self._scrollbar_button_color)
|
||||
self._y_scrollbar.configure(button_color=self._scrollbar_button_color)
|
||||
|
||||
if "scrollbar_hover_color" in kwargs:
|
||||
self._scrollbar_hover_color = self._check_color_type(kwargs.pop("scrollbar_hover_color"))
|
||||
self._x_scrollbar.configure(scrollbar_hover_color=self._scrollbar_hover_color)
|
||||
self._y_scrollbar.configure(scrollbar_hover_color=self._scrollbar_hover_color)
|
||||
if "scrollbar_button_hover_color" in kwargs:
|
||||
self._scrollbar_button_hover_color = self._check_color_type(kwargs.pop("scrollbar_button_hover_color"))
|
||||
self._x_scrollbar.configure(button_hover_color=self._scrollbar_button_hover_color)
|
||||
self._y_scrollbar.configure(button_hover_color=self._scrollbar_button_hover_color)
|
||||
|
||||
if "corner_radius" in kwargs:
|
||||
self._corner_radius = kwargs.pop("corner_radius")
|
||||
|
@ -1,6 +1,6 @@
|
||||
from tkinter.font import Font
|
||||
import copy
|
||||
from typing import List, Callable, Tuple
|
||||
from typing import List, Callable, Tuple, Optional
|
||||
|
||||
from ..theme.theme_manager import ThemeManager
|
||||
|
||||
@ -21,26 +21,27 @@ class CTkFont(Font):
|
||||
"""
|
||||
|
||||
def __init__(self,
|
||||
family: str = "default",
|
||||
size: int = "default",
|
||||
weight: str = "normal",
|
||||
family: Optional[str] = None,
|
||||
size: Optional[int] = None,
|
||||
weight: str = None,
|
||||
slant: str = "roman",
|
||||
underline: bool = False,
|
||||
overstrike: bool = False):
|
||||
|
||||
self._size_configure_callback_list: List[Callable] = []
|
||||
|
||||
self._family = family
|
||||
self._size = ThemeManager.theme["text"]["size"] if size == "default" else size
|
||||
self._tuple_style_string = f"{weight} {slant} {'underline' if underline else ''} {'overstrike' if overstrike else ''}"
|
||||
self._size = ThemeManager.theme["CTkFont"]["size"] if size is None else size
|
||||
|
||||
super().__init__(family=ThemeManager.theme["text"]["font"] if family == "default" else family,
|
||||
super().__init__(family=ThemeManager.theme["CTkFont"]["family"] if family is None else family,
|
||||
size=-abs(self._size),
|
||||
weight=weight,
|
||||
weight=ThemeManager.theme["CTkFont"]["weight"] if weight is None else weight,
|
||||
slant=slant,
|
||||
underline=underline,
|
||||
overstrike=overstrike)
|
||||
|
||||
self._family = super().cget("family")
|
||||
self._tuple_style_string = f"{super().cget('weight')} {slant} {'underline' if underline else ''} {'overstrike' if overstrike else ''}"
|
||||
|
||||
def add_size_configure_callback(self, callback: Callable):
|
||||
""" add function, that gets called when font got configured """
|
||||
self._size_configure_callback_list.append(callback)
|
||||
@ -61,6 +62,10 @@ class CTkFont(Font):
|
||||
self._size = kwargs.pop("size")
|
||||
super().configure(size=-abs(self._size))
|
||||
|
||||
if "family" in kwargs:
|
||||
super().configure(family=kwargs.pop("family"))
|
||||
self._family = super().cget("family")
|
||||
|
||||
super().configure(**kwargs)
|
||||
|
||||
# update style string for create_scaled_tuple() method
|
||||
@ -73,6 +78,8 @@ class CTkFont(Font):
|
||||
def cget(self, attribute_name: str) -> any:
|
||||
if attribute_name == "size":
|
||||
return self._size
|
||||
if attribute_name == "family":
|
||||
return self._family
|
||||
else:
|
||||
return super().cget(attribute_name)
|
||||
|
||||
|
@ -19,9 +19,13 @@ class ThemeManager:
|
||||
with open(theme_name_or_path, "r") as f:
|
||||
cls.theme = json.load(f)
|
||||
|
||||
if sys.platform == "darwin":
|
||||
cls.theme["text"] = cls.theme["text"]["macOS"]
|
||||
elif sys.platform.startswith("win"):
|
||||
cls.theme["text"] = cls.theme["text"]["Windows"]
|
||||
else:
|
||||
cls.theme["text"] = cls.theme["text"]["Linux"]
|
||||
# filter theme values for platform
|
||||
for key in cls.theme.keys():
|
||||
# check if values for key differ on platforms
|
||||
if "macOS" in cls.theme[key].keys():
|
||||
if sys.platform == "darwin":
|
||||
cls.theme[key] = cls.theme[key]["macOS"]
|
||||
elif sys.platform.startswith("win"):
|
||||
cls.theme[key] = cls.theme[key]["Windows"]
|
||||
else:
|
||||
cls.theme[key] = cls.theme[key]["Linux"]
|
||||
|
12
setup.cfg
12
setup.cfg
@ -2,7 +2,7 @@
|
||||
name = customtkinter
|
||||
version = 4.6.3
|
||||
description = Create modern looking GUIs with Python
|
||||
long_description = CustomTkinter UI-Library\n\n[](https://github.com/TomSchimansky/CustomTkinter/blob/master/documentation_images/Windows_dark.png)\n\nMore Information: https://github.com/TomSchimansky/CustomTkinter
|
||||
long_description = file: Readme.md
|
||||
long_description_content_type = text/markdown
|
||||
url = https://github.com/TomSchimansky/CustomTkinter
|
||||
author = Tom Schimansky
|
||||
@ -17,8 +17,16 @@ classifiers =
|
||||
python_requires = >=3.7
|
||||
packages =
|
||||
customtkinter
|
||||
customtkinter.widgets
|
||||
customtkinter.utility
|
||||
customtkinter.windows
|
||||
customtkinter.windows.widgets
|
||||
customtkinter.windows.widgets.appearance_mode
|
||||
customtkinter.windows.widgets.core_rendering
|
||||
customtkinter.windows.widgets.core_widget_classes
|
||||
customtkinter.windows.widgets.font
|
||||
customtkinter.windows.widgets.image
|
||||
customtkinter.windows.widgets.scaling
|
||||
customtkinter.windows.widgets.theme
|
||||
install_requires =
|
||||
darkdetect
|
||||
typing_extensions; python_version<="3.7"
|
||||
|
85
test/manual_integration_tests/test_theme colors.py
Normal file
85
test/manual_integration_tests/test_theme colors.py
Normal file
@ -0,0 +1,85 @@
|
||||
import tkinter
|
||||
import customtkinter
|
||||
|
||||
customtkinter.set_appearance_mode("dark") # Modes: "System" (standard), "Dark", "Light"
|
||||
customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"
|
||||
|
||||
app = customtkinter.CTk()
|
||||
app.geometry("1100x900")
|
||||
app.title("CustomTkinter simple_example.py")
|
||||
|
||||
|
||||
def create_all_widgets(master, state="normal"):
|
||||
label_1 = customtkinter.CTkLabel(master=master, justify=tkinter.LEFT)
|
||||
label_1.pack(pady=10, padx=10)
|
||||
|
||||
progressbar_1 = customtkinter.CTkProgressBar(master=master)
|
||||
progressbar_1.pack(pady=10, padx=10)
|
||||
|
||||
button_1 = customtkinter.CTkButton(master=master, state=state)
|
||||
button_1.pack(pady=10, padx=10)
|
||||
|
||||
slider_1 = customtkinter.CTkSlider(master=master, from_=0, to=1, state=state)
|
||||
slider_1.pack(pady=10, padx=10)
|
||||
slider_1.set(0.5)
|
||||
|
||||
entry_1 = customtkinter.CTkEntry(master=master, placeholder_text="CTkEntry", state=state)
|
||||
entry_1.pack(pady=10, padx=10)
|
||||
|
||||
optionmenu_1 = customtkinter.CTkOptionMenu(master, values=["Option 1", "Option 2", "Option 42 long long long..."], state=state)
|
||||
optionmenu_1.pack(pady=10, padx=10)
|
||||
optionmenu_1.set("CTkOptionMenu")
|
||||
|
||||
combobox_1 = customtkinter.CTkComboBox(master, values=["Option 1", "Option 2", "Option 42 long long long..."], state=state)
|
||||
combobox_1.pack(pady=10, padx=10)
|
||||
optionmenu_1.set("CTkComboBox")
|
||||
|
||||
checkbox_1 = customtkinter.CTkCheckBox(master=master, state=state)
|
||||
checkbox_1.pack(pady=10, padx=10)
|
||||
|
||||
radiobutton_var = tkinter.IntVar(value=1)
|
||||
|
||||
radiobutton_1 = customtkinter.CTkRadioButton(master=master, variable=radiobutton_var, value=1, state=state)
|
||||
radiobutton_1.pack(pady=10, padx=10)
|
||||
|
||||
radiobutton_2 = customtkinter.CTkRadioButton(master=master, variable=radiobutton_var, value=2, state=state)
|
||||
radiobutton_2.pack(pady=10, padx=10)
|
||||
|
||||
switch_1 = customtkinter.CTkSwitch(master=master, state=state)
|
||||
switch_1.pack(pady=10, padx=10)
|
||||
|
||||
text_1 = customtkinter.CTkTextbox(master=master, width=200, height=70, state=state)
|
||||
text_1.pack(pady=10, padx=10)
|
||||
text_1.insert("0.0", "CTkTextbox\n\n\n\n")
|
||||
|
||||
segmented_button_1 = customtkinter.CTkSegmentedButton(master=master, values=["CTkSegmentedButton", "Value 2"], state=state)
|
||||
segmented_button_1.pack(pady=10, padx=10)
|
||||
|
||||
tabview_1 = customtkinter.CTkTabview(master=master, width=200, height=100, state=state)
|
||||
tabview_1.pack(pady=10, padx=10)
|
||||
tabview_1.add("CTkTabview")
|
||||
tabview_1.add("Tab 2")
|
||||
|
||||
|
||||
frame_0 = customtkinter.CTkFrame(master=app, fg_color="transparent")
|
||||
frame_0.grid(row=0, column=0, padx=10, pady=10)
|
||||
create_all_widgets(frame_0, state="disabled")
|
||||
|
||||
frame_1 = customtkinter.CTkFrame(master=app, fg_color="transparent")
|
||||
frame_1.grid(row=0, column=1, padx=10, pady=10)
|
||||
create_all_widgets(frame_1)
|
||||
|
||||
frame_2 = customtkinter.CTkFrame(master=app)
|
||||
frame_2.grid(row=0, column=2, padx=10, pady=10)
|
||||
create_all_widgets(frame_2)
|
||||
|
||||
frame_3 = customtkinter.CTkFrame(master=app)
|
||||
frame_3.grid(row=0, column=3, padx=10, pady=10)
|
||||
frame_4 = customtkinter.CTkFrame(master=frame_3)
|
||||
frame_4.grid(row=0, column=0, padx=25, pady=25)
|
||||
create_all_widgets(frame_4)
|
||||
|
||||
appearance_mode_button = customtkinter.CTkSegmentedButton(app, values=["light", "dark"], command=lambda v: customtkinter.set_appearance_mode(v))
|
||||
appearance_mode_button.grid(row=1, column=0, columnspan=3, padx=25, pady=25)
|
||||
|
||||
app.mainloop()
|
Loading…
Reference in New Issue
Block a user