Ronald Oussoren <ronaldousso...@mac.com> added the comment:

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

----------
resolution:  -> third party
stage:  -> resolved
status: open -> pending

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue46573>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to