fixed scaling

This commit is contained in:
Tom Schimansky 2022-05-01 23:38:02 +02:00
parent cb12711b5c
commit e0eebac62c
3 changed files with 4 additions and 7 deletions

View File

@ -27,6 +27,8 @@ class CTkBaseClass(tkinter.Frame):
self.widget_scaling = ScalingTracker.get_widget_scaling(self) self.widget_scaling = ScalingTracker.get_widget_scaling(self)
self.spacing_scaling = ScalingTracker.get_spacing_scaling(self) self.spacing_scaling = ScalingTracker.get_spacing_scaling(self)
super().configure(width=self.apply_widget_scaling(self.desired_width), height=self.apply_widget_scaling(self.desired_height))
# save latest geometry function and kwargs # save latest geometry function and kwargs
class GeometryCallDict(TypedDict): class GeometryCallDict(TypedDict):
function: Callable function: Callable

View File

@ -1,5 +1,5 @@
import tkinter import tkinter
import customtkinter # <- import the CustomTkinter module import customtkinter
customtkinter.set_appearance_mode("System") # Other: "Dark", "Light" customtkinter.set_appearance_mode("System") # Other: "Dark", "Light"
customtkinter.set_default_color_theme("green") # Themes: "blue" (standard), "green", "dark-blue" customtkinter.set_default_color_theme("green") # Themes: "blue" (standard), "green", "dark-blue"

View File

@ -17,7 +17,6 @@ class App(customtkinter.CTk):
MAIN_COLOR_DARK = "#2D5862" MAIN_COLOR_DARK = "#2D5862"
MAIN_HOVER = "#05f4b7" MAIN_HOVER = "#05f4b7"
def __init__(self, *args, **kwargs): def __init__(self, *args, **kwargs):
super().__init__(*args, **kwargs) super().__init__(*args, **kwargs)
@ -28,14 +27,13 @@ class App(customtkinter.CTk):
self.protocol("WM_DELETE_WINDOW", self.on_closing) self.protocol("WM_DELETE_WINDOW", self.on_closing)
# ============ create two CTkFrames ============ # ============ create two CTkFrames ============
#1
self.frame_left = customtkinter.CTkFrame(master=self, self.frame_left = customtkinter.CTkFrame(master=self,
width=220, width=220,
height=App.HEIGHT-40, height=App.HEIGHT-40,
corner_radius=5) corner_radius=5)
self.frame_left.place(relx=0.38, rely=0.5, anchor=tkinter.E) self.frame_left.place(relx=0.38, rely=0.5, anchor=tkinter.E)
print(self.frame_left.widget_scaling)
#2
self.frame_right = customtkinter.CTkFrame(master=self, self.frame_right = customtkinter.CTkFrame(master=self,
width=350, width=350,
height=App.HEIGHT-40, height=App.HEIGHT-40,
@ -52,7 +50,6 @@ class App(customtkinter.CTk):
self.entry_output = customtkinter.CTkEntry(master=self.frame_right, width=320, height=38, corner_radius=5) self.entry_output = customtkinter.CTkEntry(master=self.frame_right, width=320, height=38, corner_radius=5)
self.entry_output.place(relx=0.05, rely=0.18, anchor=tkinter.NW) self.entry_output.place(relx=0.05, rely=0.18, anchor=tkinter.NW)
def button_outputFunc(self): def button_outputFunc(self):
self.entry_output.delete(0, 'end') self.entry_output.delete(0, 'end')
filename = fd.askdirectory() filename = fd.askdirectory()
@ -66,8 +63,6 @@ class App(customtkinter.CTk):
self.mainloop() self.mainloop()
if __name__ == "__main__": if __name__ == "__main__":
app = App() app = App()
app.start() app.start()