tkinter mainloop() function logs me out of my mac

tkinter crashes mac
downgrade tkinter mac
tkinter restarts my mac
tkinter mojave
install python 3.5 mac
python for mac
tkinter crashing python

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")

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

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.

script with tkinkter logs me out (Mac os 10.14.6) : learnpython, script with tkinkter logs me out (Mac os 10.14.6) from tkinter import * master = Tk() var1 = IntVar() Checkbutton(master, text='male', Tried it with " master.​mainloop() " Now I'm wondering when you know that you have to define a function. Reference: MacOS 10.14, Python 3.6 from Anaconda, Spyder 3.3.4 I'm just getting started with tkinter in Python, and am trying to run a simple demo code found here from within Spyder.

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

Plotting with Tkinter on Mojave 10.14.6 causes a crash & log out , Let me know if anyone has figured out the mac crashing problem due to Tkinter. @anntzer anntzer added the OS/Apple  While this bug has been fixed in more recent versions of 8.5.x and in 8.6.x, the version of Tk shipped by Apple with macOS has not been updated since Mac OS X 10.7 (!) and so apps that use it will see this crash. Which Tk a particular instance of Python tkinter will link with depends on how that Python was built.

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()

python, destroy() just terminates the mainloop and deletes all widgets. So it seems to be safer if you call your app from another Tkinter app, or if you  I asked that in another thread, but it got lost: When do you use root.quit() and when do you use root.destroy() to exit a Tkinter program? Also, can you intercept an exit when you use the little x in the title bar, just to affirm that you really want to exit, or you in case you should save data as a file before you exit.

As everyone mentioned above, there is a bug. I was using Python from Anaconda and it was logging me out. For a workaround, download Python again but from and use the python.exe file of the new download as environment to use tkinter and it will work perfect.

How to Build a Python GUI Application With wxPython – Real Python, Designing the User Interface; Creating the User Interface; Make a Functioning The wxPython GUI toolkit is a Python wrapper around a C++ library called such as PyQt or Tkinter, is that wxPython uses the actual widgets on the MainLoop() Note: The application will look different when you run it on Mac or Windows. There's a hint on how to make the Tkinter window take focus when you call mainloop() in the Tkinter._test() function. # The following three commands are needed so the window pops # up on top on Windows root.iconify() root.update() root.deiconify() root.mainloop()

Tk Tutorial, The general state of Tk documentation (outside the Tcl-oriented reference and variations and how they interact with Python, see the Mac Tcl/Tk page at python.​org. button = {text "Hello World"}.grid Tk.mainloop() would invoke the function inside the tkinter module, while we'd need "ttk.Entry(. In our code, we have created out Python function that will be called when we click our Tkinter button. In our button, we have added our function to the command just like you can see below: button = Button(win, text="Click me", command = my_fun) button.pack()

(Tutorial) Introduction to GUI With TKINTER in PYTHON, Windows, Mac OS X. It blends the best of Python and Qt and provides flexibility Finally, as the last step, you use the mainloop() method to display the out which other widgets are available in Tkinter and the functioning of each of them. "Keep Me Logged In").grid(columnspan = 2) window.mainloop(). Tkinter is already present in your Python in standard Linux, Microsoft Windows, and Mac OS X. Creating your first GUI with Python Now you know what Tkinter is, and you have Python installed in your system.

Why does my MacOS Mojave 10.14.6 log me out when I run a , I am on macbook air early 2013 version running 10.14.6 (18G95) with 8gb ram and 1.6ghz i5 Every time I press run, it logs me out of the system. The python code is just to see if tkinter module works. window.mainloop(). In this article, you'll learn the basics of GUI programming with Tkinter, the de-facto Python GUI framework. Master GUI programming concepts such as widgets, geometry managers, and event handlers. Then, put it all together by building two applications: a temperature converter and a text editor.

  • 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, 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.
  • 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 I don't use Mac but I see people use some brew to install Python.
  • 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.