0

I'm using macOS 10.14.6 with Python 3.8.2 and tk version 8.6.8, when I run any tk related code, even like this:

window = tk.Tk()
window.title('my window')
window.geometry('200x100')

window.mainloop()

The system will be crashed (screen blacked out and then logged off and reboot with login screen)

I searched online and most people say it is old version tk's bug, but I think I'm using a newer version of tk 8.6.8 and python 3.8.2. So I'm confused about that.

  • What's the model fo your MacBook(e.g. 2011 MacBook Air)? – Sergio Ley-Languren May 08 '20 at 02:13
  • Pick one from [` [tkinter] macos crash`(https://stackoverflow.com/search?q=is%3Aanswer+%5Btkinter%5D+macos+crash) – stovfl May 08 '20 at 16:33
  • Does this answer your question? [Tkinter crashes computer after MacOS 10.14.6 update](https://stackoverflow.com/questions/57435896/tkinter-crashes-computer-after-macos-10-14-6-update) – Sergio Ley-Languren May 08 '20 at 17:18
  • @SergioLey-Languren Hi, I'm using MacBook Pro 15-inch 2018. And I checked the link that you provided, they say this looks like a macOS bug and could be solved in macOS 10.15. But I didn't find how to solve it without update to 10.15 – ericgao4 May 08 '20 at 22:41

1 Answers1

0

You need add library tkmacosx.

Try this:

Snippet:

import tkinter as tk
from tkmacosx import Label


window = tk.Tk()
window.title('my window')
window.geometry('200x100')

label = Label(window, text=f'Tkinter crashes macOS 10.14.6')
label.pack()

window.mainloop()
toyota Supra
  • 3,181
  • 4
  • 15
  • 19