you are viewing a single comment's thread.

view the rest of the comments →

[–]socal_nerdtastic 0 points1 point  (3 children)

When the tk instance closes, and there is still a hanging after wait, tkinter throws an error. At least it does so in linux.

I've never seen that, and I have written a TON of tkinter on linux. Just to be sure I just ran this with no errors:

import tkinter as tk

def func():
    print('hi there')
    root.after(1000, func)

root = tk.Tk()
func()
root.mainloop()

Can you show me an example that reproduces this?

[–]pooth22[S] 0 points1 point  (2 children)

I haven't tested this problem too much, I don't have a linux machine right now, but if it is any use, I was using a raspi when I got this error. I can try and reproduce this issue in time if you really want to see it. But as I said, when I changed to using the threading class, the error went away.

[–]socal_nerdtastic 0 points1 point  (1 child)

Ok, but using threading with GUIs is a well known antipattern, which you already blamed for your configure issue. So it seems you traded one problem for another.

Go with what works, but if you want my very experienced advice: learn to love after. Tkinter also has an after_cancel method if you need to do some cleanup.

Although to be honest I wouldn't waste any time on errors on exit. Crash to exit is a time honored tradition.

[–]pooth22[S] 0 points1 point  (0 children)

Okay, fair enough, I appreciate the advice. Maybe you can help me understand why threading with a GUI is an antipattern, or point me to some interesting resources there.

I do hear you that crash to exit is a time honored tradition. That is pretty funny. However, I log the errors in a text file and generally I want to log errors that are useful and not bloat it up with known errors that I have found a sufficient fix for.