updatet complex_example.py with switches

This commit is contained in:
TomSchimansky
2022-03-08 17:33:51 +01:00
parent 3285eba2ef
commit 2ab5b7e19f
8 changed files with 79 additions and 57 deletions

View File

@ -3,7 +3,7 @@
"window_bg_color": ["gray92", "gray12"],
"button": ["#1FA6E8", "#1C94CF"],
"button_hover": ["#1A89BF", "#1673A1"],
"button_border": ["gray25", "gray86"],
"button_border": ["gray40", "gray70"],
"checkbox_border": ["gray40", "gray60"],
"entry": ["white", "gray24"],
"entry_border": ["gray70", "gray32"],
@ -22,7 +22,7 @@
"slider_button_hover": ["#1A89BF", "#1673A1"],
"switch": ["gray70", "gray35"],
"switch_progress": ["#1FA6E8", "#1C94CF"],
"switch_button": ["gray38", "gray70"],
"switch_button": ["gray36", "gray75"],
"switch_button_hover": ["gray30", "gray90"],
"darken_factor": 0.8
},

View File

@ -1,16 +1,16 @@
{
"color": {
"window_bg_color": ["gray94", "gray10"],
"window_bg_color": ["gray98", "gray10"],
"button": ["#608BD5", "#395E9C"],
"button_hover": ["#A4BDE6", "#748BB3"],
"button_border": ["gray25", "gray86"],
"button_border": ["gray40", "gray70"],
"checkbox_border": ["gray40", "gray60"],
"entry": ["white", "gray24"],
"entry_border": ["gray70", "gray32"],
"entry_placeholder_text": ["gray52", "gray62"],
"frame_border": ["#A7C2E0", "#5FB4DD"],
"frame_low": ["gray89", "gray16"],
"frame_high": ["gray84", "gray20"],
"frame_low": ["gray92", "gray16"],
"frame_high": ["gray86", "gray20"],
"label": [null, null],
"text": ["gray12", "gray90"],
"progressbar": ["#6B6B6B", "gray6"],

View File

@ -4,7 +4,7 @@
"window_bg_color": ["gray92", "gray12"],
"button": ["#72CF9F", "#11B384"],
"button_hover": ["#0E9670", "#0D8A66"],
"button_border": ["gray25", "gray86"],
"button_border": ["gray40", "gray70"],
"checkbox_border": ["gray40", "gray60"],
"entry": ["white", "gray24"],
"entry_border": ["gray70", "gray32"],

View File

@ -109,7 +109,7 @@ class CTkLabel(tkinter.Frame):
self.width = event.width
self.height = event.height
self.canvas.config(width=self.width, height=self.height)
# self.canvas.config(width=self.width, height=self.height)
self.draw()
def draw(self):

View File

@ -20,7 +20,7 @@ class CTkSettings:
9: 'D', 8: 'D', 7: 'D', 6: 'F', 5: 'D', 4: 'G', 3: 'G', 2: 'H', 1: 'H', 0: 'A'}
radius_to_char_fine_windows_11 = {19: 'A', 18: 'A', 17: 'B', 16: 'B', 15: 'B', 14: 'B', 13: 'C', 12: 'C', 11: 'D', 10: 'D',
9: 'D', 8: 'F', 7: 'C', 6: 'I', 5: 'E', 4: 'G', 3: 'P', 2: 'R', 1: 'R', 0: 'A'}
9: 'E', 8: 'F', 7: 'C', 6: 'I', 5: 'E', 4: 'G', 3: 'P', 2: 'R', 1: 'R', 0: 'A'}
if sys.platform.startswith("win"):
if sys.getwindowsversion().build > 20000: # Windows 11

View File

@ -238,6 +238,9 @@ class CTkSwitch(tkinter.Frame):
self.variable.set(self.offvalue)
self.variable_callback_blocked = False
def get(self):
return self.onvalue if self.check_state is True else self.offvalue
def on_enter(self, event=0):
self.hover_state = True
self.canvas.itemconfig("slider_parts", fill=CTkThemeManager.single_color(self.button_hover_color, self.appearance_mode),