This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ronaldoussoren
Recipients ned.deily, remyrfouquette, ronaldoussoren
Date 2022-02-02.10:11:45
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1643796705.69.0.625208248977.issue46573@roundup.psfhosted.org>
In-reply-to
Content
I've done some more research and this is an integration issue between pyglet and Tk. In particular:

* Both pyglet and Tk use AppKit to implement their GUI
* AppKit uses an NSApplication class, and in particular a singleton instance of that class, to represent the application, which will get instantiated during application startup
* The Tk library uses a sublclass of NSApplication with additional functionality (TkApplication).
* When pyglet is started first the NSApplication singleton is an instance of NSApplication and not of TkApplication, but Tk's implementation assumes that the singleton is an instance of TkApplicationo.

A workaround for this issue is to make sure Tk is initialised before initialising pyglet. For example using this code at the start of the script: "from tkinter import Tk; root = Tk()"


There's not much we can do about this in CPython, other than maybe filing an issue with the Tk project about this. I haven't looked at the Tk codebase and there cannot tell how hard it would be for then to avoid a dependency on TkApplication as a separate class (for example by implementing the additional functionality they need in a category on NSApplication).
History
Date User Action Args
2022-02-02 10:11:45ronaldoussorensetrecipients: + ronaldoussoren, ned.deily, remyrfouquette
2022-02-02 10:11:45ronaldoussorensetmessageid: <1643796705.69.0.625208248977.issue46573@roundup.psfhosted.org>
2022-02-02 10:11:45ronaldoussorenlinkissue46573 messages
2022-02-02 10:11:45ronaldoussorencreate