Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to fix Tkinter? Every code with GUI crashes mac os with respring

I was practicing tkinter with PyCharm for my own project with serial and arduino. Nothing special about it - few buttons, option-menu and labels. But I clicked on Mac's menu bar in the tkinter's GUI window on the option "Show tab bar". And then macbook had a reboot. After it - every script with tkinter's GUI reboots my macbook on executing. A blank window is shown for a second and then mac reboots. I'm using Mojave 10.14.6 (18G84)

I deleted python 3.7 interpreter from mac and reinstalled PyCharm. I cleared cache folders for python and PyCharm.

import tkinter
tkinter._test() # and it crashes now ever in this code...

UPD: updated MacOS to 10.14.6 (18G87) - still the same issue

like image 461
Denis Omelchenko Avatar asked Aug 07 '19 18:08

Denis Omelchenko


4 Answers

Have you tried to downgrade tkinter to a version below the one causing a crash?

I.e going from 8.6.8 to 8.6.7 in conda can be done by executing:

conda install tk 8.6.7 

this is all it took to fix an identical issue and error log, might also work with pip

like image 107
Nik Pavlenko Avatar answered Nov 04 '22 22:11

Nik Pavlenko


Seems to be a common problem python.org/download/mac/tcltk/#built-in-8-6-8 according to them

If you are using macOS 10.6 or later, the Apple-supplied Tcl/Tk 8.5 has serious bugs that can cause application crashes.

Rather than fixing TCL/TK I recommend you to want to reinstall a python version that satisfies the requirement & use it python.org/downloads/release/python-374

like image 25
BPDESILVA Avatar answered Nov 04 '22 23:11

BPDESILVA


I ran into this issue on Mojave 10.14.6 after installing python 3.7.4 and tkinter 8.6.8 using Miniconda3.

Downgrading to python 3.7.0 fixed this issue for me.

conda install python=3.7.0
like image 1
Max Avatar answered Nov 04 '22 22:11

Max


I have the same issue with python 3.7.0, tk 8.6.8 in anaconda3 in macOS 10.14.6: once I start my tk interface script the OS logs out without an error message showed or error report filed. Windows are also lost.

My problem was solved once I update to macOS 10.15.3. Tk is working properly and haven't spotted a new issue.

like image 1
Adam Lyu Avatar answered Nov 05 '22 00:11

Adam Lyu