Re: [Pyobjc-dev] Displaying a numpy array
Brought to you by:
ronaldoussoren
|
From: Ronald O. <ron...@ma...> - 2009-03-31 13:42:06
|
On 30 Mar, 2009, at 21:28, Thomas Robitaille wrote: > Hello, > > I have been using Python for a few months, and have now learned how to > use PyObjC in a basic way to design a Cocoa interface (.nib) for a > python script. > > I am interested in displaying a numpy array or PIL image using the > interface. Is the way to do this to use an OpenGL view? or an Image > View? Are there examples of such scripts anywhere? I looked at the > OpenGLDemo.py example, but could not understand how this could be used > to display the contents of an array. > > Any advice would be welcome, There will be some code to convert to/from PIL images in a future release of PyObjC, but I haven't written that code yet and wouldn't mind if someone send me a patch for that ;-). A kludgy way to display a PIL image is to convert the image to a string and then create an NSImage from that. I have no personal experience with numpy or OpenGL. AFAIK the OpenGL stuff works almost completely through PyOpenGL and the Cocoa bindings in Cocoa are just a way to represent a regular OpenGL canvas as a Cocoa object. That btw. would be another nice contribution to PyObjC: write an OpenGL example that does something more interesting than displaying a solid color. I guess a rotating teapot would be appropriate for such an example. Ronald > > Thanks, > > Thomas > > ------------------------------------------------------------------------------ > _______________________________________________ > Pyobjc-dev mailing list > Pyo...@li... > https://lists.sourceforge.net/lists/listinfo/pyobjc-dev |