[PD-dev] pyext looper

B. Bogart ben at ekran.org
Fri Aug 12 19:00:31 CEST 2005


Hi thomas +,

What was supposed to be very simple task has ended up dissolving my
brain and now I have no idea how to solve it so I'm asking on here.

What I am trying to accomplish is more or less this:

for x in xrange(x_upper-x_lower):
   for y in xrange(y_upper-y_lower):
     for z in xrange(z_upper-z_lower):
       self._outlet(1,x+x_lower)
       self._outlet(2,y+y_lower)
       self._outlet(3,z+z_lower)

All this does is step through each point in a 3D matrix of points, and
output the coordinates of each point.

The catch is that I need to send out these messages with a variable
delay between them. I tried using the thread example from pyext which
works fine on all my machines but was crashing windows badly (I'm using
this patch to control a serial control camera, and that camera only
works on a particular windows machine at work.

So I thought I would rewrite the script without sleep() and use an
external metro to drive it.

Now I can't figure out how to write a function that I call over and over
again that is identical to the above code-block except doing only one
iteration at a time.

If someone has an abstraction or a solution to this I'd be happy to see
it. Unfortunatly the camera is locked away in a room at the University
that I can't access over the weekend, so I would need to try and get
this to work in the next 2 hours. :(

Thanks in advance,
B.

PS: obviously any until/counter based solution will be great as well,
but I had trouble getting that logic to work for me as well.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 256 bytes
Desc: OpenPGP digital signature
URL: <http://lists.puredata.info/pipermail/pd-dev/attachments/20050812/97b02aa8/attachment.pgp>


More information about the Pd-dev mailing list