fixed small bugs, add CTkFiledialog which is tkinter.filedialog

This commit is contained in:
TomSchimansky
2022-11-12 13:28:16 +01:00
parent f302b045e3
commit e269091ffe
5 changed files with 12 additions and 8 deletions

View File

@ -101,7 +101,10 @@ class CTkBaseClass(tkinter.Frame, CTkAppearanceModeBaseClass, CTkScalingBaseClas
def _draw(self, no_color_updates: bool = False):
""" can be overridden but super method must be called """
if no_color_updates is False:
super().configure(bg=self._apply_appearance_mode(self._bg_color))
# Configuring color of tkinter.Frame not necessary at the moment?
# Causes flickering on Windows and Linux for segmented button for some reason!
# super().configure(bg=self._apply_appearance_mode(self._bg_color))
pass
def config(self, *args, **kwargs):
raise AttributeError("'config' is not implemented for CTk widgets. For consistency, always use 'configure' instead.")

View File

@ -1,3 +1,4 @@
import ctypes.wintypes
import tkinter
import sys
from typing import Callable
@ -118,7 +119,7 @@ class ScalingTracker:
pass # high DPI scaling works automatically on macOS
elif sys.platform.startswith("win"):
from ctypes import windll
from ctypes import windll, wintypes
windll.shcore.SetProcessDpiAwareness(2)
# Microsoft Docs: https://docs.microsoft.com/en-us/windows/win32/api/shellscalingapi/ne-shellscalingapi-process_dpi_awareness
else:
@ -154,6 +155,7 @@ class ScalingTracker:
for window in cls.window_widgets_dict:
if window.winfo_exists() and not window.state() == "iconic":
current_dpi_scaling_value = cls.get_window_dpi_scaling(window)
print("current dpi:", current_dpi_scaling_value)
if current_dpi_scaling_value != cls.window_dpi_scaling_dict[window]:
cls.window_dpi_scaling_dict[window] = current_dpi_scaling_value