Skip to content

Instantly share code, notes, and snippets.

@pho
Created May 6, 2014 09:32
Show Gist options
  • Save pho/f48f031445b79290aebc to your computer and use it in GitHub Desktop.
Save pho/f48f031445b79290aebc to your computer and use it in GitHub Desktop.
Pygame basics
import pygame
from time import sleep
pygame.init()
window = pygame.display.set_mode((800, 600))
pygame.display.set_caption("Control Mental")
white = pygame.Color(255, 255, 255)
black = pygame.Color(0, 0, 0)
blue = pygame.Color(100, 100, 255)
red = pygame.Color(255, 100, 100)
green = pygame.Color(100, 255, 100)
window.fill(black)
def TriVerde():
window.fill(black)
pygame.draw.polygon(window, green, [[400, 100], [100, 500], [700, 500]], 0)
pygame.display.flip()
def CirRojo():
window.fill(black)
pygame.draw.circle(window, red, (400, 300), 200, 0)
pygame.display.flip()
def scan_keyboard():
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit(0)
CirRojo()
sleep(2)
TriVerde()
sleep(2)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment