[Pythonmac-SIG] Opening a Cocoa window from a Python C extension

Michiel Jan Laurens de Hoon mdehoon at ims.u-tokyo.ac.jp
Thu Feb 12 08:41:33 EST 2004


Wow I got it to work by using pythonw. Actually I had tried pythonw before but I 
  didn't get it to work correctly at that time (probably has to do with readline 
support). After reinstalling python from the source using configure 
--enable-framework and with readline support, pythonw works correctly. My 
windows behave as they should and also I don't have problems with setting the 
cursor any more. Thanks Bob!

I will continue working on porting Pygist to Mac OS X, and I'll post a message 
here once it is available.

Thanks again,

--Michiel.

>> I am porting PyGist (a scientific plotting package for Python, mainly 
>> written in C) to Mac OS X. PyGist was originally written for 
>> Linux/Unix machines and was recently ported to Windows. For the Mac OS 
>> X port, I am using Cocoa to create the graphics windows and calls to 
>> CoreGraphics for the actual drawing. The graphics work fine, but there 
>> is still a problem with Cocoa windows created from a Python C 
>> extension module.
> 
> Applications in OS X *must* be run from a bundle.  Run your script with 
> pythonw, build a bundle yourself (as you did), or use bundlebuilder.  
> See http://pythonmac.org/wiki/FAQ .  It has absolutely nothing to do 
> with Terminal.app.
> 
> You may also want to consider using PyObjC instead of writing ObjC code.
> 
> -bob

-- 
Michiel de Hoon, Assistant Professor
University of Tokyo, Institute of Medical Science
Human Genome Center
4-6-1 Shirokane-dai, Minato-ku
Tokyo 108-8639
Japan
http://bonsai.ims.u-tokyo.ac.jp/~mdehoon




More information about the Pythonmac-SIG mailing list