I have a program and whenever I scale the window or click on a button there is major lag. It only happens when styled (ThemedTk module or style files).
Minimum Reproducible Example
from tkinter import ttk
from ttkthemes import ThemedTk
root = ThemedTk(theme="equilux")
root.columnconfigure(tuple(range(4)), weight=1)
root.rowconfigure(tuple(range(4)), weight=1)
ttk.Button(root, text="Top").grid(column=0, row=0, sticky="news", columnspan=4)
ttk.Button(root, text="Top Left").grid(column=0, row=1, sticky="news")
ttk.Button(root, text="Center").grid(column=1, row=1, sticky="news", columnspan=2, rowspan=2)
ttk.Button(root, text="Bottom Left").grid(column=0, row=2, sticky="news")
ttk.Button(root, text="Very Bottom Left").grid(column=0, row=3, sticky="news")
ttk.Button(root, text="Bottom").grid(column=1, row=3, sticky="news", columnspan=3)
ttk.Button(root, text="Bottom Right").grid(column=3, row=2, sticky="news")
ttk.Button(root, text="Top Right").grid(column=3, row=1, sticky="news")
root.mainloop()
If I remove the ThemedTk and replace it with a normal tk then it doesn't lag. It didn't lag with built in themes and the only other theme I tried was Rdbende's Azure Theme. It only lags with the rowconfigure
and columnconfigure
. I want those so everything scales with the screen. The resizing lag isn't much of a issue for what I am making but I can't have it lag when I press a button
as i understood it's something wrong with ThemedTk module here is the edited code with ttkboosttrap module which is one of the best themes and style changers with great futures atm :
from ttkbootstrap import *
root = Window(themename="litera")
root.columnconfigure(tuple(range(4)), weight=1)
root.rowconfigure(tuple(range(4)), weight=1)
Button(root, text="Top",bootstyle='outlined').grid(column=0, row=0, sticky="news", columnspan=4)
Button(root, text="Top Left",bootstyle='outlined').grid(column=0, row=1, sticky="news")
Button(root, text="Center",bootstyle='outlined').grid(column=1, row=1, sticky="news", columnspan=2, rowspan=2)
Button(root, text="Bottom Left",bootstyle='outlined').grid(column=0, row=2, sticky="news")
Button(root, text="Very Bottom Left",bootstyle='outlined').grid(column=0, row=3, sticky="news")
Button(root, text="Bottom",bootstyle='outlined').grid(column=1, row=3, sticky="news", columnspan=3)
Button(root, text="Bottom Right",bootstyle='outlined').grid(column=3, row=2, sticky="news")
Button(root, text="Top Right",bootstyle='outlined').grid(column=3, row=1, sticky="news")
root.mainloop()
> Here is the website for more informations.