[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Tkinter on Mac OS crashes python

On Tue, 14 May 2019 11:22:54 -0600, Chip Towner wrote:

> 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

You might need to add...

from tkinter import Tk

<Wildman> GNU/Linux user #557453
The cow died so I don't need your bull!