1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19
| import pygame,sys
pygame.init() window=pygame.display.set_mode([700,850]) window.fill([255,255,255]) pygame.display.update()
while True: for event in pygame.event.get(): if event.type == pygame.QUIT: sys.exit() if event.type == pygame.KEYDOWN: if event.key == pygame.K_ESCAPE: sys.exit() if event.type == pygame.MOUSEBUTTONDOWN: x, y = pygame.mouse.get_pos() print(x,y) pygame.draw.rect(window, (100,100,100), (x, y, 50, 60), 0) pygame.display.update()
|