Advertisement
Guest User

Untitled

a guest
Apr 23rd, 2014
37
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 0.77 KB | None | 0 0
  1. pygame.init()
  2.  
  3. screen = pygame.display.set_mode((1000,600))
  4. screen.fill((255,255,255))
  5. brush = pygame.image.load(os.path.join('C:Python27','brush.png'))
  6. brush = pygame.transform.scale(brush,(128,128))
  7.  
  8. pygame.display.update()
  9. clock = pygame.time.Clock()
  10.  
  11. z = 0
  12.  
  13. while 1:
  14. clock.tick(60)
  15. x,y = pygame.mouse.get_pos()
  16. for event in pygame.event.get():
  17. if event.type==pygame.QUIT:
  18. sys.exit()
  19. elif event.type == MOUSEBUTTONDOWN:
  20. z=1
  21. elif event.type == MOUSEBUTTONUP:
  22. z=0
  23.  
  24. if z==1:
  25. screen.blit(brush,(x-64,y-64))
  26. pygame.display.update()
  27.  
  28. ...
  29. if event.type==pygame.QUIT:
  30. sys.exit() # <-- missing indentation
  31. elif event.type == MOUSEBUTTONDOWN:
  32. z=1 # <-- missing indentation
  33. elif event.type == MOUSEBUTTONUP:
  34. z=0 # <-- missing indentation
  35. ....
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement