Created
May 6, 2014 09:32
-
-
Save pho/f48f031445b79290aebc to your computer and use it in GitHub Desktop.
Pygame basics
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
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