From memory (and cobwebbed memory, at that:-) I recall that I never got Tkinter 
and Cocoa to work together. The runloops got into each others’ ways. Similar 
for other GUI toolkits (Gtk, for example).

I did (with lots of pulling of hairs and gnashing of teeth) get Cocoa GUI to 
work together with other NSFoundation stuff (as long as it didn’t touch the 
gui) by giving it a runloop in a different thread.

But: this was about 6 years ago, things may have progressed since then…

Jack

> On  06-Sep-2017, at 22:57 , Ronald Oussoren <ronaldousso...@mac.com> wrote:
> 
> Hi,
> 
> I’m kind of hoping that a Tkinter or Tk expert is reading this…
> 
> A PyObjC user tries to call Tkinter from a Cocoa program (that is, the Cocoa 
> runloop starts before the Tkinter one) and gets an error message:
> 
>    -[NSApplication _setup:]: unrecognized selector sent to instance
> 
> Furthermore the Tkinter GUI doesn’t work. PyObjC’s issue about this: 
> 
>    
> https://bitbucket.org/ronaldoussoren/pyobjc/issues/201/tkinter-method-tk-failed-with-error
> 
> I’ve done some quick browsing of the Tk source code and it appears that Tk 
> assumes that -[NSApplication sharedApplication] returns an instance of a 
> Tk-specific private subclass of NSApplication and that won’t be true when the 
> Tk runloop is started before the Cocoa one.
> 
> My question: is my analysis correct? And has anyone successfully mixed PyObjC 
> and Tkinter in this way? I guess this issue could be avoided by initialising 
> Tk before calling into Cocoa.
> 
> Ronald
> _______________________________________________
> Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
> https://mail.python.org/mailman/listinfo/pythonmac-sig
> unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG

--
Jack Jansen, <jack.jan...@cwi.nl>, http://www.cwi.nl/~jack
If I can't dance I don't want to be part of your revolution -- Emma Goldman



_______________________________________________
Pythonmac-SIG maillist  -  Pythonmac-SIG@python.org
https://mail.python.org/mailman/listinfo/pythonmac-sig
unsubscribe: https://mail.python.org/mailman/options/Pythonmac-SIG

Reply via email to