i'm using Python and Tkinter for GUI. I've a function using switch and ttk for switching between light and dark mode:
def ThemeChanger():
if screen.tk.call("ttk::style", "theme", "use") == "sun-valley-dark":
# Set light theme
screen.tk.call("set_theme", "light")
else:
# Set dark theme
screen.tk.call("set_theme", "dark"
But when I clicked into the switch, all the UI automatically scales a litter bit:


It will scale larger if i use tabs or table in ttk Tkinter, and won't scale back when switch to light mode, it scales more and more when I clicked into theme switch button:
def change_theme():
# NOTE: The theme's real name is sun-valley-<mode>
if root.tk.call("ttk::style", "theme", "use") == "sun-valley-dark":
# Set light theme
root.tk.call("set_theme", "light")
else:
# Set dark theme
root.tk.call("set_theme", "dark")





I don't know how to fix this. I would so appreciate if anyone can recommend me improving these. Thank you!