-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathpythongame.py
28 lines (25 loc) · 860 Bytes
/
pythongame.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
"""draw_rect1"""
import sys
import pygame
from pygame.locals import QUIT, Rect
pygame.init()
SURFACE = pygame.display.set_mode((400, 300))
FPSCLOCK = pygame.time.Clock()
def main():
while True:
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
SURFACE.fill((255,255,255))
pygame.draw.rect(SURFACE, (255, 0, 0), (10, 20, 100, 50))
pygame.draw.rect(SURFACE, (255, 0, 0), (150, 10, 100, 30), 3)
pygame.draw.rect(SURFACE, (0, 255, 0), ((100, 80), (80, 50)))
rect0 = Rect(200, 60, 140, 80)
pygame.draw.rect(SURFACE, (0, 0, 255), rect0)
rect1 = Rect((30, 160), (100, 50))
pygame.draw.rect(SURFACE, (255, 255, 0), rect1)
pygame.display.update()
FPSCLOCK.tick(3)
if __name__=="__main__":
main()