fixes for Windows

This commit is contained in:
TomSchimansky 2022-04-21 18:45:51 +02:00
parent 6342bf8034
commit c3b50239b1
3 changed files with 6 additions and 7 deletions

View File

@ -77,7 +77,7 @@ class ScalingTracker:
DPI100pc = 96 # DPI 96 is 100% scaling
DPI_type = 0 # MDT_EFFECTIVE_DPI = 0, MDT_ANGULAR_DPI = 1, MDT_RAW_DPI = 2
window_hwnd = wintypes.HWND(window)
window_hwnd = wintypes.HWND(window.winfo_id())
monitor_handle = windll.user32.MonitorFromWindow(window_hwnd, wintypes.DWORD(2)) # MONITOR_DEFAULTTONEAREST = 2
x_dpi, y_dpi = wintypes.UINT(), wintypes.UINT()
windll.shcore.GetDpiForMonitor(monitor_handle, DPI_type, pointer(x_dpi), pointer(y_dpi))

View File

@ -12,11 +12,10 @@ class CTkCanvas(tkinter.Canvas):
self.aa_circle_canvas_ids = set()
def get_char_from_radius(self, radius):
if CTkSettings.scaling_factor == 1:
if radius >= 20:
return "A"
else:
return self.radius_to_char_fine[radius]
if radius >= 20:
return "A"
else:
return self.radius_to_char_fine[radius]
def create_aa_circle(self, x_pos, y_pos, radius, angle=0, fill="white", tags="", anchor=tkinter.CENTER) -> str:
# create a circle with a font element

View File

@ -4,7 +4,7 @@ import customtkinter # <- import the CustomTkinter module
customtkinter.set_appearance_mode("dark") # Modes: "System" (standard), "Dark", "Light"
customtkinter.set_default_color_theme("blue") # Themes: "blue" (standard), "green", "dark-blue"
customtkinter.ScalingTracker.set_user_scaling(0.9)
customtkinter.ScalingTracker.set_user_scaling(1.5)
root_tk = customtkinter.CTk() # create CTk window like you do with the Tk window (you can also use normal tkinter.Tk window)
root_tk.geometry("400x480")