Mittwoch, 12. Mai 2010

Python 047 pyprocessing + mouseevent + color


#You can easily use mouse-events in pyprocessing. Here I combine mouse position with a RGB-color-value.

from pyprocessing import *

size(900,600)
background(1, 1, 1)
strokeWeight(6)
x1 = 0
y1 = 0
x2 = 0
y2 = 0
x = [0,0,0]
y = [0,0,0]

def draw():
if mouse.pressed:
x1 = mouse.x
y1 = mouse.y
if mouse.pressed:
x2 = pmouse.x
y2 = pmouse.y
stroke(x1,y1,1)
line(x1, y1, x2, y2)
run()

Here is the code with identation:
http://bit.ly/c4QD2o

Keine Kommentare:

 
eXTReMe Tracker