Reference: MacOS 10.14, Python 3.6 from Anaconda, Spyder 3.3.4
I'm just getting started with tkinter in Python, and am trying to run a simple demo code found here from within Spyder. For completeness, the 6-line script is as follows:
import tkinter as tk
r = tk.Tk()
r.title('Counting Seconds')
button = tk.Button(r, text='Stop', width=25, command=r.destroy)
button.pack()
r.mainloop()
When I run this, however, it hangs. No beach ball, no freezing, just nothing happening. The only way to get out of the hung command is to re-start the IPython kernel, or close and re-launch Spyder.
I think I've traced the problem line to:
r = tk.Tk()
which causes a hang in the same way if executed by itself.
I know there are a number of issues between Tkinter and Python on MacOS (e.g. this), but none that I've seen seem to recreate this specific issue.
Any ideas?