Posted By

fadehelix on 08/07/09


Tagged

python pygame


Versions (?)

Create blank pygame window


 / Published in: Python
 

URL: http://www.pygame.org/docs/ref/mouse.html#pygame.mouse.get_pos

  1. #!/usr/bin/python
  2. import pygame
  3. from pygame.locals import *
  4.  
  5. def main():
  6. pygame.init()
  7. pygame.display.set_mode((300,200))
  8. pygame.display.set_caption('Testing')
  9. running = True
  10. while running:
  11. for event in pygame.event.get():
  12. if event.type == QUIT:
  13. running = False
  14. if event.type == KEYDOWN and event.key == K_ESCAPE:
  15. running = False
  16. if event.type == MOUSEBUTTONDOWN:
  17. #print event.button
  18. print pygame.mouse.get_pos()
  19. pygame.display.quit()
  20.  
  21. if __name__ == '__main__':
  22. main()

Report this snippet  

You need to login to post a comment.