question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

macOS Tk failing from release 20220222 onwards.

See original GitHub issue

Hey @indygreg,

It’s me again, exploring your wonderful project, and experiencing a tkinter failure on macOS.

My minimal test:

import tkinter
root = tkinter.Tk()

Works up to 20220222. On that release, with 3.10.2, fails with:

Python 3.10.2 (main, Feb 20 2022, 20:00:41) [Clang 13.0.1 ] on darwin
Type "help", "copyright", "credits" or "license" for more information.
>>> import tkinter
>>> root = tkinter.Tk()
2022-06-21 21:28:57.868 PuPPY[81171:2337557] -[TKApplication tkProcessEvent:]: unrecognized selector sent to instance 0x7f958b774200
2022-06-21 21:28:57.871 PuPPY[81171:2337557] *** Terminating app due to uncaught exception 'NSInvalidArgumentException', reason: '-[TKApplication tkProcessEvent:]: unrecognized selector sent to instance 0x7f958b774200'
*** First throw call stack:
(
	0   CoreFoundation                      0x00007fff2d05e035 __exceptionPreprocess + 256
	1   libobjc.A.dylib                     0x00007fff578c6a17 objc_exception_throw + 48
	2   CoreFoundation                      0x00007fff2d0d7fce -[NSObject(NSObject) __retain_OA] + 0
	3   CoreFoundation                      0x00007fff2cfffe9f ___forwarding___ + 1485
	4   CoreFoundation                      0x00007fff2cfff848 _CF_forwarding_prep_0 + 120
	5   libpython3.10.dylib                 0x000000010f6a9ca7 TkMacOSXEventsCheckProc + 351
	6   libpython3.10.dylib                 0x000000010f5ab4cf Tcl_DoOneEvent + 306
	7   libpython3.10.dylib                 0x000000010f6a1ede TkpInit + 389
	8   libpython3.10.dylib                 0x000000010f62130c Initialize + 2046
	9   libpython3.10.dylib                 0x000000010f97471c Tkapp_New + 924
	10  libpython3.10.dylib                 0x000000010f9740a0 _tkinter_create + 640
	11  libpython3.10.dylib                 0x000000010f76ce3b cfunction_vectorcall_FASTCALL + 171
	12  libpython3.10.dylib                 0x000000010f81e123 call_function + 419
	13  libpython3.10.dylib                 0x000000010f819f7f _PyEval_EvalFrameDefault + 28159
	14  libpython3.10.dylib                 0x000000010f8129fa _PyEval_Vector + 2362
	15  libpython3.10.dylib                 0x000000010f71ac06 _PyObject_FastCallDictTstate + 262
	16  libpython3.10.dylib                 0x000000010f71b6c8 _PyObject_Call_Prepend + 152
	17  libpython3.10.dylib                 0x000000010f79084f slot_tp_init + 207
	18  libpython3.10.dylib                 0x000000010f788ed4 type_call + 324
	19  libpython3.10.dylib                 0x000000010f71a86d _PyObject_MakeTpCall + 253
	20  libpython3.10.dylib                 0x000000010f81e241 call_function + 705
	21  libpython3.10.dylib                 0x000000010f819f7f _PyEval_EvalFrameDefault + 28159
	22  libpython3.10.dylib                 0x000000010f8129fa _PyEval_Vector + 2362
	23  libpython3.10.dylib                 0x000000010f87267b PyRun_InteractiveOneObjectEx + 1227
	24  libpython3.10.dylib                 0x000000010f8714eb _PyRun_InteractiveLoopObject + 427
	25  libpython3.10.dylib                 0x000000010f870ae7 _PyRun_AnyFileObject + 103
	26  libpython3.10.dylib                 0x000000010f8743c8 PyRun_AnyFileExFlags + 168
	27  libpython3.10.dylib                 0x000000010f896114 Py_RunMain + 2788
	28  libpython3.10.dylib                 0x000000010f8973a1 pymain_main + 1681
	29  libpython3.10.dylib                 0x000000010f8977eb Py_BytesMain + 43
	30  libdyld.dylib                       0x00007fff590963d5 start + 1
	31  ???                                 0x0000000000000001 0x0 + 1
)
libc++abi.dylib: terminating with uncaught exception of type NSException
Abort trap: 6

What else I tested:

  • Failing – macOS 10.14.6:

    • 3.10 pgo, lto, pgo+lto, and debug builds.
    • 3.9 pgo and lto builds.
    • 3.10 pgo build of the most recent release, 20220528.
  • Working – CentOS 7 Linux and Windows, both x86-64:

    • 3.10 build of most recent release.

Release notes for 20220222 indicate that Tcl/Tk was upgraded from 8.6.10 to 8.6.12, so this provides at least some explanation to my observations.

Can you please help in getting Tk back in shape on macOS? How can I assist in the process?

Again, thanks a lot for sharing the project and, in advance, for helping address this.

Issue Analytics

  • State:closed
  • Created a year ago
  • Comments:6 (5 by maintainers)

github_iconTop GitHub Comments

0reactions
tmontescommented, Jul 2, 2022

@indygreg,

Wow, thank you very much for such a speedy fix. I do confirm that Tk based applications work nicely on macOS (and Windows and Linux) now!

Amazing! 😃

Read more comments on GitHub >

github_iconTop Results From Across the Web

Why tkinter fails on Mac - python - Stack Overflow
If you are using macOS 10.6 or later, the Apple-supplied Tcl/Tk 8.5 has serious bugs that can cause application crashes.
Read more >
IDLE and tkinter with Tcl/Tk on macOS - Python.org
Aqua Cocoa support was backported to Tk 8.5 (prior to 8.5.13) and released by Apple starting with macOS 10.6 and by ActiveState starting...
Read more >
How to Install Tkinter on MacOS? - GeeksforGeeks
In this article, we will learn how to install Tkinter in Python on MacOS. Tkinter is a Python binding to the Tk GUI...
Read more >
Mac OS Monterey Python Version? | Apple Developer Forums
For anyone who has Mac OS Monterey installed, it's just a case of opening up ... xcode sdk BUILD FAILED (OS X 12.0.1...
Read more >
TkDocs Tutorial - Installing Tk
Though pretty much all macOS and Linux machines come with Tk installed already, ... macOS versions include an early 8.5 version (8.5.9, released...
Read more >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found