On 5/14/2019 9:27 PM, Wildman via Python-list wrote:
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

No, Tk is a class defined in tkinter.py.



--
Terry Jan Reedy


--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to