예제 #1
0
 def onMouseDown(self, canvas, x, y):
     canvas.x = x
     canvas.y = y
     canvas.pen(10, 0xDF34AB, 50)
     canvas.move(x-25, y-25)
     canvas.line(x+25, y+25)
     canvas.move(x+25, y-25)
     canvas.line(x-25, y+25)
예제 #2
0
파일: canvas.py 프로젝트: StetHD/nevow
 def onMouseDown(self, canvas, x, y):
     canvas.x = x
     canvas.y = y
     canvas.pen(10, 0xDF34AB, 50)
     canvas.move(x-25, y-25)
     canvas.line(x+25, y+25)
     canvas.move(x+25, y-25)
     canvas.line(x-25, y+25)
예제 #3
0
 def manipulateACanvas(self, canvas):
     canvas.reposition(*rndpt(self.width, self.height))
     canvas.S = S = canvas.sound('http://localhost/amen.mp3')
     S.play(timesLoop=5)
     for x in range(random.randint(1, 4)):
         canvas.pen( 
             random.randint(1, 10),
             random.randint(0, 0xffffff),
             random.randint(0, 100))
         canvas.move(*rndpt(self.width, self.height))
         choice = random.randint(0, 4)
         if choice == 0:
             canvas.line(*rndpt(self.width, self.height))
         elif choice == 1:
             canvas.fill(random.randint(0, 0xffffff), random.randint(0, 100))
             for x in range(random.randint(3, 20)):
                 if random.randint(0, 1):
                     canvas.line(*rndpt(self.width, self.height))
                 else:
                     canvas.curve(*rndrct(self.width, self.height))
             canvas.close()
         elif choice == 2:
             canvas.curve(*rndrct(self.width, self.height))
         elif choice == 3:
             T = canvas.text(random.choice(self.original), *(0,0,400,100))
             # This is an example of how you can hold on to drawing objects and continue to
             # draw on them later, because the CanvasSocket holds itself open until done() is called
             Textorizer(T, self.width, self.height)
         else:
             # This demo requires a folder of images which I don't want to put in
             # the nevow source. Hooking this up is left as an exercise for the reader.
             continue
             imgname = random.choice(os.listdir("flsh/images"))
             I = canvas.image('/images/%s' % imgname)
             I.scale(*rndp())
             I.alpha(random.randint(0, 100))
             rotate = random.randint(-180, 180)
             I.rotate(rotate)
             I.move(*rndpt(self.width, self.height))
예제 #4
0
파일: canvas.py 프로젝트: StetHD/nevow
 def manipulateACanvas(self, canvas):
     canvas.reposition(*rndpt(self.width, self.height))
     canvas.S = S = canvas.sound('http://localhost/amen.mp3')
     S.play(timesLoop=5)
     for x in range(random.randint(1, 4)):
         canvas.pen( 
             random.randint(1, 10),
             random.randint(0, 0xffffff),
             random.randint(0, 100))
         canvas.move(*rndpt(self.width, self.height))
         choice = random.randint(0, 4)
         if choice == 0:
             canvas.line(*rndpt(self.width, self.height))
         elif choice == 1:
             canvas.fill(random.randint(0, 0xffffff), random.randint(0, 100))
             for x in range(random.randint(3, 20)):
                 if random.randint(0, 1):
                     canvas.line(*rndpt(self.width, self.height))
                 else:
                     canvas.curve(*rndrct(self.width, self.height))
             canvas.close()
         elif choice == 2:
             canvas.curve(*rndrct(self.width, self.height))
         elif choice == 3:
             T = canvas.text(random.choice(self.original), *(0,0,400,100))
             # This is an example of how you can hold on to drawing objects and continue to
             # draw on them later, because the CanvasSocket holds itself open until done() is called
             Textorizer(T, self.width, self.height)
         else:
             # This demo requires a folder of images which I don't want to put in
             # the nevow source. Hooking this up is left as an exercise for the reader.
             continue
             imgname = random.choice(os.listdir("flsh/images"))
             I = canvas.image('/images/%s' % imgname)
             I.scale(*rndp())
             I.alpha(random.randint(0, 100))
             rotate = random.randint(-180, 180)
             I.rotate(rotate)
             I.move(*rndpt(self.width, self.height))