I'm a beginner at Tkinter. Yesterday, when I try to start a message box in a thread function, but it failed and stuck. I didn't find any useful information about this problem, so I asked here:
from tkinter import *
from threading import Thread
def func():
messagebox.askyesno()
t = Thread(target=func)
Label(text='Hello').pack()
t.start()
mainloop()
No error. it just doesn't work. I also find that any dialog can not be created in the thread procedure.
Thanks for any help, or useful information.
You cannot call a tkinter widget method from any thread other than the one it was created in, and you can only ever create widgets in a single thread.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With