From Dirk.Engelmann@iwr.uni-heidelberg.de Wed Feb 12 15:16:13 1997 From: Dirk.Engelmann@iwr.uni-heidelberg.de (Dirk Engelmann) Date: Wed, 12 Feb 1997 16:16:13 +0100 (MET) Subject: [PYTHON IMAGE-SIG] passing tuple to c and back Message-ID: Hi, I would like to pass a tuple from python to a C-array. Then after some calculations in C a tuple should be returned to the calling python program. I tried to do like this: The Python calling sequence looks like x = ( 1, 2, 3 ) y = c_module( x ) print y The C-module makes some trouble. (my attempts to pass simple objects as intergers and floats are OK) PySequence_SetItem(vec, i, newobj) returns -1 , obviously vec is not a seqence object ?! Is there any proposition to get it working? Thanks for help! regards, Dirk Engelmann -------------------------------------------------------------- Here is the module in C: static PyObject *c_module( PyObject *self, PyObject *args ) { PyObject *vec, *obj[N],*newobj ; int x[N]; int i, n; if ( !PyArg_ParseTuple( args, "O", &vec ) ) return NULL; if (!PySequence_Check(vec)) return NULL; n=PyObject_Length(vec); for (i = 0; i < n; i++) { obj[i] = PySequence_GetItem(vec, i); PyArg_Parse(obj[i],"i",&x[i]); } /* here: insert calculations on x */ for (i = 0; i < n; i++) { newobj = PyFloat_FromDouble( x[i] ); PySequence_SetItem(vec, i, newobj); } return Py_BuildValue("O",vec); } _______________ IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org _______________ From aaron_watters@msn.com Thu Feb 13 03:35:33 1997 From: aaron_watters@msn.com (aaron watters) Date: Thu, 13 Feb 97 03:35:33 UT Subject: [PYTHON IMAGE-SIG] passing tuple to c and back Message-ID: I'm unsure if this is causing your problem, but you should never try to modify a tuple value after it has been properly initialized: maybe the abstract.c functions you use are smart enough to know this so they refuse to do the setitem... Actually this is pretty likely. If you want to return a tuple you must make a new tuple and initialize it using the tuple specific accessor functions, I think. -- Aaron Watters _______________ IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org _______________ From ivantk@hotmail.com Sun Feb 16 19:18:13 1997 From: ivantk@hotmail.com ( Ivan Tkatchev) Date: Sun, 16 Feb 1997 11:18:13 -0800 (PST) Subject: [PYTHON IMAGE-SIG] Transparency in TK Message-ID: <199702161918.LAA11337@f21.hotmail.com> Sorry to bother anyone, but is there a way to implement true transoparency in Tkinter? I am working on an application that will involve animated icons moving over various backgrounds. I would like there to be transparent areas in the icons. Thanks. --------------------------------------------------------- Get Your *Web-Based* Free Email at http://www.hotmail.com --------------------------------------------------------- _______________ IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org _______________ From fredrik_lundh@ivab.se Mon Feb 17 12:40:06 1997 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Mon, 17 Feb 1997 13:40:06 +0100 Subject: [PYTHON IMAGE-SIG] Transparency in TK In-Reply-To: <199702161918.LAA11337@f21.hotmail.com> (ivantk@hotmail.com) Message-ID: <9702171240.AA14383@arnold.image.ivab.se> > Sorry to bother anyone, but is there a way to implement true > transoparency in Tkinter? I am working on an application that will > involve animated icons moving over various backgrounds. I would > like there to be transparent areas in the icons. There's been a few posts to the Tcl list containing code that makes GIFs and XPMs fully transparent. It's probably not much work to hack the PIL tkinter interface so it supports this feature. (Yes, it's on my list... might be able to squeeze it into 0.2b5). Cheers /F _______________ IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org _______________ From fredrik_lundh@ivab.se Mon Feb 17 13:09:50 1997 From: fredrik_lundh@ivab.se (Fredrik Lundh) Date: Mon, 17 Feb 1997 14:09:50 +0100 Subject: [PYTHON IMAGE-SIG] Re: How to derive classes in the Imaging library In-Reply-To: Message-ID: <9702171309.AA15131@arnold.image.ivab.se> > I am trying to derive a new class from class Image in Image.py in > Fredrik Lundh's PIL (Python Imaging Library). I'm not entirely sure of > the reasoning behind the Image class structure, but it uses a factory > function in the module called new to create new instances of class > Image. This is, I guess, so that images can be created in different > ways (ie from a file with the open() factory function). The Image class is just a wrapper for the internal ImagingCore type; it was never really designed for general subclassing... But as you pointed out, the _makeself method allows you to get some control over what all those factory methods in there really returns. > I guess a different way of looking at it is - Is there any way of > initialising the baseClass part from a derived class __init__() > given a already existing instance of the base class? Maybe you could do something like: class XImage(Image): def __init__(self, mode, size, bg = 0): # initialize base class part Image.__init__(self) # whatever def _makeself(self, im): # wrap ImagingCore object in a suitable Python class Cheers /F _______________ IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org _______________ From kimhornung@vip.cybercity.dk Sun Feb 23 22:31:43 1997 From: kimhornung@vip.cybercity.dk (Kim Hornung) Date: Sun, 23 Feb 1997 23:31:43 +0100 (CET) Subject: [PYTHON IMAGE-SIG] Using PyOpenGL on Win95 with PythonWin? Message-ID: <1.5.4.16.19970223233015.2ea70d18@vip.cybercity.dk> I would love to play with OpenGL (PyOpenGL) on Win95 with PythonWin. The documentation suggest that it's possible. But I need the 'glu' module (maybe more that this one?). And I'm not keen on trying to build them myself. So if anybody has compiled the necessary files already, I would really appreciate if you could point me to them. Thanks [and I'm sorry if this question has been asked before - I'm new to this SIG] Kim _______________ IMAGE-SIG - SIG on Image Processing with Python send messages to: image-sig@python.org administrivia to: image-sig-request@python.org _______________