添加链接
link之家
链接快照平台
  • 输入网页链接,自动生成快照
  • 标签化管理网页链接
Collectives™ on Stack Overflow

Find centralized, trusted content and collaborate around the technologies you use most.

Learn more about Collectives

Teams

Q&A for work

Connect and share knowledge within a single location that is structured and easy to search.

Learn more about Teams

The below code logs me out of my Mac. Once I logged in again, the Anaconda navigator is not visible, but the process is running in the background. I have to run a 'killall python' command in terminal before starting anaconda navigator again.

I tried running in Spyder and also in the Python terminal. The same issue exists.

 from tkinter import Tk
 root = Tk()
 Title = root.title("sample")
 root.mainloop()

Not sure what I am missing here. Help me to understand this strange issue.

if you have no error then hard to say anythink. It seems problem only on your computer/system. tkinter needs language tcl and its module tk to work but it should be preinstalled with tkinter. But you may try to install it. Or check if you can run tcl shell - tclsh – furas Aug 20, 2019 at 8:29 @furas, Thanks for your reply. tclsh is working in my terminal. Also I don't think this is my computer/system issue. I have tried the same code in another mac book pro. when root.mainloop() is executed the display went off and I had to restart my mac book. tkinter is available in my system as tkinter.filedialog.askopenfilename() function is opening file dialogue window without any issue. root.mainloop() causes this issue. – Duvaragesh Aug 21, 2019 at 8:39 it shows it is problem on mac books. It works on other systems - Windows, Linux. Because it doesn't display any error message so there is no clue what is the problem. The only idea: reinstall Anaconda or install different Python - CPython from python.org. I don't use Mac but I see people use some brew to install Python. – furas Aug 21, 2019 at 9:12 I've got the same problem on MacOS 10.14.6 anaconda/bin/pythonw did not solve the problem and the line that causes my crash is "window = Tk() " not the mainloop line. I can verify this in the interpreter. – djp3 Sep 2, 2019 at 22:54

Pythonw solved my issue.

We need to change the PATH_TO_INTERPRETER for the one where pythonw is in our OS. eg. In spyder, Preferences---> Python Interpreter -> Choose 'use the following Python interpreter' radio button and choose the path to pythonw

Changing interpreter to pythonw solved my "running python with tkinter root.mainloop() and logging me out of macOS" problem

(10.14.6 macOS) Python 3 tkinter root.mainloop()

This issues is due to update in macOS (10.14.6).

Tk.Tk() is working fine in macOs (10.14.5).

most certainly it is a macOS bug, but I don't think they will bother to fix this when they are so close to their 10.15 release.

In any python interpreter, when running tk.Tk() it makes macOS crash and logout giving the following error: $ CGSTrackingRegionSetIsEnabled returned CG error 268435459 $ HIToolbox: received notification of WindowServer event port death.

But, still I am trying to identify any workaround for this issue.

Thanks for contributing an answer to Stack Overflow!

  • Please be sure to answer the question. Provide details and share your research!

But avoid

  • Asking for help, clarification, or responding to other answers.
  • Making statements based on opinion; back them up with references or personal experience.

To learn more, see our tips on writing great answers.