Hardware Reference
In-Depth Information
os.environ['SDL_VIDEO_WINDOW_POS'] = 'center'
pygame.display.set_caption(“Klido-Sketch”)
segSize = 350
screen = pygame.display.set_mode([segSize*2,segSize*2],0,32)
segment = pygame.Surface((segSize,segSize))
lastEncoder = [0,0]
current_reading = [128,128]
last_reading = [128,128,128,128]
# defines initial starting position
col = (0,0,0)
colCursor = (128,128,128)
background = (255, 255, 255) # screen background colour
picture = 1 # picture number
fileName =”name”
lastPort = -1
def main():
global current_reading, last_reading
print “Kilido-sketch the keys are:-”
print “R, G, B, Y, M, P, K (black), W to select colour”
print “Space bar for wipe screen”
print “L - for Line to saved point, C for Circle centre on ;
save point”
print “S to save current point for future line and ;
circle commands”
print “Home key to save sketch to file”
print “# to post on Flickr and Facebook”
blank_screen()
while(True): # do forever
readEncoders()
pygame.draw.rect(segment,col,(last_reading[0],;
last_reading[1],2,2),0)
pygame.draw.line(segment,col,(last_reading[0],;
last_reading[1]),(current_reading[0],current_reading[1]),2)
pygame.draw.rect(segment,colCursor,;
(current_reading[0],current_reading[1],2,2),0)
last_reading[0] = current_reading[0]
# save this position for drawing from for next time
last_reading[1] = current_reading[1]
screenUpdate()
def screenUpdate():
continued
Search WWH ::




Custom Search