TkinterEP / ttkthemes

A group of themes for the ttk extenstions for Tkinter
GNU General Public License v3.0
364 stars 47 forks source link

Maximum recursion depth exceeded when using toplevel=True option #74

Closed kev-a-s closed 4 years ago

kev-a-s commented 4 years ago

__init__toplevel should be set before potential call to set_theme. set_theme can call _setup_toplevel_hook, which will overwrite Toplevel.__init__ before it has been saved. This leads to infinite recursion when a Toplevel is created.

https://github.com/TkinterEP/ttkthemes/blob/82b848b7d3ca269c843df1b418b9132c744cc1da/ttkthemes/themed_tk.py#L66-L67

Akuli commented 4 years ago

does this have something to do with the __getattr__ in tkinter.Tk?

kev-a-s commented 4 years ago

No. I should have given steps to reproduce. root = ThemedTk(theme='black', toplevel=True) win = Toplevel(master=root)

Can be avoided by doing a config call after init instead of passing toplevel = True to constructor.

RedFantom commented 4 years ago

Hello! Thank you for opening this issue. This indeed appears to be a bug. Could you try the fix I applied in the fix branch?

kev-a-s commented 4 years ago

That works.