aboutsummaryrefslogtreecommitdiff
path: root/externals/grill/py
diff options
context:
space:
mode:
Diffstat (limited to 'externals/grill/py')
-rw-r--r--externals/grill/py/scripts/sendrecv.py13
-rw-r--r--externals/grill/py/scripts/simple.py5
-rw-r--r--externals/grill/py/scripts/tcltk.py8
-rw-r--r--externals/grill/py/scripts/threads.py8
4 files changed, 25 insertions, 9 deletions
diff --git a/externals/grill/py/scripts/sendrecv.py b/externals/grill/py/scripts/sendrecv.py
index f31eae2d..5b0cc1df 100644
--- a/externals/grill/py/scripts/sendrecv.py
+++ b/externals/grill/py/scripts/sendrecv.py
@@ -18,7 +18,12 @@ There are several classes exposing py/pyext features:
"""
-import pyext
+try:
+ import pyext
+except:
+ print "ERROR: This script must be loaded by the PD/Max pyext external"
+
+
from time import sleep
#################################################################
@@ -142,7 +147,7 @@ class ex3(pyext._class):
# make flower
self._tocanvas("obj",ori.real,ori.imag,"bng",20,250,50,0,"empty","yeah","empty",0,-6,64,8,-24198,-1,-1)
- for i in range(num):
+ for i in xrange(num):
l[i] = ori+rad*exp(complex(0,i*2*pi/num))
self._tocanvas("obj",l[i].real,l[i].imag,"bng",15,250,50,0,"empty","yeah"+str(i),"empty",0,-6,64,8,0,-1,-1)
self._tocanvas("connect",2,0,3+i,0)
@@ -153,7 +158,7 @@ class ex3(pyext._class):
sleep(1./(i+1))
# move objects around
- for i in range(200):
+ for i in xrange(200):
ix = randint(0,num-1)
l[ix] = ori+rad*complex(2*random()-1,2*random()-1)
self._send("yeah"+str(ix),"pos",l[ix].real,l[ix].imag)
@@ -162,7 +167,7 @@ class ex3(pyext._class):
# now delete
# this is not well-done... from time to time an object remains
self._tocanvas("editmode",1)
- for i in range(num):
+ for i in xrange(num):
self._tocanvas("mouse",l[i].real,l[i].imag,0,0)
self._tocanvas("cut")
diff --git a/externals/grill/py/scripts/simple.py b/externals/grill/py/scripts/simple.py
index 60cebec7..da35a6b4 100644
--- a/externals/grill/py/scripts/simple.py
+++ b/externals/grill/py/scripts/simple.py
@@ -63,7 +63,10 @@ pyext Usage:
"""
-import pyext
+try:
+ import pyext
+except:
+ print "ERROR: This script must be loaded by the PD/Max pyext external"
#################################################################
diff --git a/externals/grill/py/scripts/tcltk.py b/externals/grill/py/scripts/tcltk.py
index 154a51b1..04828a25 100644
--- a/externals/grill/py/scripts/tcltk.py
+++ b/externals/grill/py/scripts/tcltk.py
@@ -7,7 +7,11 @@
"""This is an example script for showing a nonsense tcl/tk application."""
-import pyext
+try:
+ import pyext
+except:
+ print "ERROR: This script must be loaded by the PD/Max pyext external"
+
from Tkinter import *
import random
@@ -40,7 +44,7 @@ class Application(Frame):
r = self.mcanv.create_rectangle(50,50,200,200)
self.mcanv.addtag_withtag('group',r)
- for i in range(500):
+ for i in xrange(500):
x = random.uniform(50,200)
y = random.uniform(50,200)
l = self.mcanv.create_line(x,y,x+1,y)
diff --git a/externals/grill/py/scripts/threads.py b/externals/grill/py/scripts/threads.py
index f7740bd3..ec0488d7 100644
--- a/externals/grill/py/scripts/threads.py
+++ b/externals/grill/py/scripts/threads.py
@@ -16,7 +16,11 @@ For threading support pyext exposes several function and variables
"""
-import pyext
+try:
+ import pyext
+except:
+ print "ERROR: This script must be loaded by the PD/Max pyext external"
+
from time import sleep
#################################################################
@@ -33,7 +37,7 @@ class ex1(pyext._class):
# method for bang to any inlet
def bang_(self,n):
- for i in range(self.loops):
+ for i in xrange(self.loops):
# if _shouldexit is true, the thread ought to stop
if self._shouldexit: break