Tkinter on Mac OS crashes python

Chip Towner chip at gct3engineering.com
Tue May 14 13:22:54 EDT 2019


I am trying to use tkinter and when I attempt to do so Python crashes.  I am accessing Python (v 3.6.8) in Spyder (v3.6) from Anaconda.  The version of TkVersion tells me the version is 8.6 and the Anaconda environment browser tells me it is 8.6.8.

An example piece of code I am trying to run (pulled from the __init__.py file in the tkinter code installed by Anaconda) is provided below.  The code crashes when tk = tkinter.Tk() is called.  I have traced the crash into this method to a call to _tkinter.create().  The debugger can’t step any further.

I can provide crash logs if desired. Any help is appreciated.

import tkinter
from tkinter.constants import *
tk = tkinter.Tk()
frame = tkinter.Frame(tk, relief=RIDGE, borderwidth=2)
frame.pack(fill=BOTH,expand=1)
label = tkinter.Label(frame, text="Hello, World")
label.pack(fill=X, expand=1)
button = tkinter.Button(frame,text="Exit",command=tk.destroy)
button.pack(side=BOTTOM)
tk.mainloop()

Chip






More information about the Python-list mailing list