changed root_tk name to app in all exmaples and tests

This commit is contained in:
Tom Schimansky
2022-05-22 20:26:31 +02:00
parent 0c7abdaec5
commit 8cafed1b06
21 changed files with 124 additions and 130 deletions

View File

@ -2,6 +2,7 @@ __version__ = "4.0.1"
import os
import sys
from tkinter.constants import *
# import manager classes
from .settings import Settings

View File

@ -19,7 +19,7 @@ except Exception:
class AppearanceModeTracker:
callback_list = []
root_tk_list = []
app_list = []
update_loop_running = False
update_loop_interval = 500 # milliseconds
@ -40,12 +40,12 @@ class AppearanceModeTracker:
cls.callback_list.append(callback)
if widget is not None:
root_tk = cls.get_tk_root_of_widget(widget)
if root_tk not in cls.root_tk_list:
cls.root_tk_list.append(root_tk)
app = cls.get_tk_root_of_widget(widget)
if app not in cls.app_list:
cls.app_list.append(app)
if not cls.update_loop_running:
root_tk.after(500, cls.update)
app.after(500, cls.update)
cls.update_loop_running = True
@classmethod
@ -97,9 +97,9 @@ class AppearanceModeTracker:
cls.update_callbacks()
# find an existing tkinter.Tk object for the next call of .after()
for root_tk in cls.root_tk_list:
for app in cls.app_list:
try:
root_tk.after(cls.update_loop_interval, cls.update)
app.after(cls.update_loop_interval, cls.update)
return
except Exception:
continue

View File

@ -168,9 +168,9 @@ class ScalingTracker:
cls.update_scaling_callbacks_for_window(window)
# find an existing tkinter object for the next call of .after()
for root_tk in cls.window_widgets_dict.keys():
for app in cls.window_widgets_dict.keys():
try:
root_tk.after(cls.update_loop_interval, cls.check_dpi_scaling)
app.after(cls.update_loop_interval, cls.check_dpi_scaling)
return
except Exception:
continue