Advertisement
Guest User

Untitled

a guest
Oct 22nd, 2016
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 0.50 KB | None | 0 0
  1. from pygame import *
  2.  
  3. init()
  4. window = display.set_mode((800, 600))
  5. window.fill(Color('#ffffff'))
  6. draw.rect(window, Color('#cccccc'), [0, 0, 100, 100])
  7.  
  8. run = 1
  9.  
  10. while run:
  11.     for e in event.get():
  12.         if e.type == MOUSEBUTTONDOWN:
  13.             window.fill(Color('#ffffff'))
  14.             position = mouse.get_pos()
  15.             draw.rect(window, Color('#cccccc'), [position[0] - 50, position[1] - 50, 100, 100])
  16.         if e.type == QUIT:
  17.             run = 0
  18.  
  19.     display.update()
  20.  
  21. quit()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement