israel-dryer / ttkbootstrap

A supercharged theme extension for tkinter that enables on-demand modern flat style themes inspired by Bootstrap.
MIT License
1.98k stars 393 forks source link

bgerror failed to handle background error #565

Open UTexasRepo opened 7 months ago

UTexasRepo commented 7 months ago

Desktop (please complete the following information):

ttkbootstrap Version [e.g. 1.10.1] OS: [e.g. Windows]

Describe the bug

I ran a simple app and am receiving bg error when I exit the program.

To Reproduce

A No Frills superhero theme

from tkinter import from ttkbootstrap.constants import import ttkbootstrap as tb

root = tb.Window(themename = "superhero") root.title("TTK Bootstrap!") root.geometry('500x350')

root.mainloop()

Expected behavior

When I exit the program, I do not expect this behavior.

Screenshots

The application runs fine image

The application when exited, producing the following error: image

Additional context

No response

mcmanustfj commented 3 days ago

this happens because the ttkbootstrap Style singleton isn't reset when the window is destroyed, and tries to use the same window that was already destroyed. You can fix this by setting ttkbootstrap.Style.instance = None before recreating the new window. My PR fixes it, but who knows when it'll go in?