1

I had a long piece of code using Tkinter, but it won't work at all. I keep getting a huge error message and then a Python tab comes up and tells me that it's crashed. I've tried on Pycharm and normally on Terminal, and none of it works. (Mac)

I wasn't sure of the problem, so I kept narrowing it down. What i've established is that everytime I use an entry widget into my function, the code crashes regardless. This works on my PC, just not on my mac. Ive tried using Conda, and updating Python, but im a real beginner, so I don't know what I' doing.

from tkinter import *
from tkinter import Tk, Button, Frame, Entry, END


def the_graph():
    yeet = entry_1.get()
    return yeet

my_window = Tk()



button_1 = Button(my_window, text=" Just work please. ", command=the_graph)

label_1 = Label(my_window, text=" Label 1")
entry_1 = Entry(my_window)


label_1.grid(row=0, column=0)
entry_1.grid(row=0, column=1)
button_1.grid(row=29, column=0)

my_window.title('my window')
my_window.mainloop()


Heres the error message:

2019-05-21 00:01:59.598 Python[30864:3667592] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[NSApplication _setup:]: unrecognized selector sent to instance 0x7f8e646f7230'
*** First throw call stack:
(
    0   CoreFoundation                      0x00007fff3b2bc43d __exceptionPreprocess + 256
    1   libobjc.A.dylib                     0x00007fff671ca720 objc_exception_throw + 48
    2   CoreFoundation                      0x00007fff3b339255 -[NSObject(NSObject) __retain_OA] + 0
    3   CoreFoundation                      0x00007fff3b25bad0 ___forwarding___ + 1486
    4   CoreFoundation                      0x00007fff3b25b478 _CF_forwarding_prep_0 + 120
    5   libtk8.6.dylib                      0x000000011c14f1f2 TkpInit + 408
    6   libtk8.6.dylib                      0x000000011c0beaac Initialize + 2454
    7   _tkinter.cpython-37m-darwin.so      0x000000011bf20dc4 Tcl_AppInit + 84
    8   _tkinter.cpython-37m-darwin.so      0x000000011bf20a98 _tkinter_create + 1144
    9   Python                              0x000000010a1434ee _PyMethodDef_RawFastCallKeywords + 430
    10  Python                              0x000000010a142a5a _PyCFunction_FastCallKeywords + 42
    11  Python                              0x000000010a2015a4 call_function + 724
    12  Python                              0x000000010a1fe576 _PyEval_EvalFrameDefault + 25190
    13  Python                              0x000000010a2020d6 _PyEval_EvalCodeWithName + 2422
    14  Python                              0x000000010a1425fb _PyFunction_FastCallDict + 523
    15  Python                              0x000000010a1438cf _PyObject_Call_Prepend + 143
    16  Python                              0x000000010a191d51 slot_tp_init + 145
    17  Python                              0x000000010a18d6a9 type_call + 297
    18  Python                              0x000000010a142871 _PyObject_FastCallKeywords + 433
    19  Python                              0x000000010a201474 call_function + 420
    20  Python                              0x000000010a1fe617 _PyEval_EvalFrameDefault + 25351
    21  Python                              0x000000010a2020d6 _PyEval_EvalCodeWithName + 2422
    22  Python                              0x000000010a1f8234 PyEval_EvalCode + 100
    23  Python                              0x000000010a2358f1 PyRun_FileExFlags + 209
    24  Python                              0x000000010a23516a PyRun_SimpleFileExFlags + 890
    25  Python                              0x000000010a2549db pymain_main + 6875
    26  Python                              0x000000010a254f2a _Py_UnixMain + 58
    27  libdyld.dylib                       0x00007fff68298085 start + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
  • 3
    I ran the exact posted code on my mac and it ran just fine, maybe try reinstalling python, or this might help you https://stackoverflow.com/questions/24068971/terminating-with-uncaught-exception-of-type-nsexception-xcode-6 – MatthewG May 20 '19 at 23:02
  • 2
    Works fine with Python3.7 on Ubuntu – Kamal May 21 '19 at 02:36
  • 1
    I'm on Mac and it works fine. However, I think probably either it has to do with the python you installed. Try run `python -m tkinter` command on terminal. If you get the same error then you should re-install condo again. Or it can also has to do with the multiple users on your mac, this can be solved by [this](https://discussions.apple.com/thread/5042957) hopefully – Saad May 21 '19 at 07:14

0 Answers0