I'm relatively new to Python and especially new to tkinter. In the following example code, the dialog works fine when created directly (left button), but the application becomes unresponsive if the dialog is created from a thread (right button). What seems to be the problem? Can threads launch dialogs? If so, how?
from tkinter import *
from tkinter import ttk
import threading
count = 0
def makeDialog():
global count
count = count + 1;
messagebox.showinfo('Click Counter','Click #{0}'.format(count))
def makeThread():
threading.Thread(target=makeDialog).start()
root = Tk()
root.title("Dialogs")
mainframe = ttk.Frame(root)
mainframe.grid(column=0, row=0)
mainframe.columnconfigure(0, weight=1)
mainframe.rowconfigure(0, weight=1)
button1 = ttk.Button(mainframe, text="Dialog", command=makeDialog)
button1.grid(row=1, column=1)
button2 = ttk.Button(mainframe, text="Thread Dialog", command=makeThread)
button2.grid(row=1, column=2)
root.mainloop()