TORONTO KIDS COMPUTER CLUB | Monday 20:00 Python Practice 20.11.09.
18589

# Monday 20:00 Python Practice 20.11.09.

## 11 Nov Monday 20:00 Python Practice 20.11.09.

Question 1:

Draw the following picture in the pygame window: (could be different color)

Hint: using pygame.draw.circle

Question 2:

Draw below image using pygame. (could using different color)

Code to draw a rectangle is

pygame.draw.rect(screen,[red,blue,green],[x,y,width,height,0]

• ##### Jesse Shi
Posted at 19:28h, 11 November Reply

import pygame
pygame.init()
screen = pygame.display.set_mode([640, 640])
screen.fill([255,255,255])
pygame.draw.circle(screen, [205,10,120], [320, 320], 300, 0)
pygame.draw.circle(screen, [35,80,1], [320, 320], 250, 0)
pygame.draw.circle(screen, [250,200,125], [320, 320], 200, 0)
pygame.draw.circle(screen, [10,255,200], [320, 320], 150, 0)
pygame.draw.circle(screen, [250,100,10], [320, 320], 100, 0)
pygame.draw.circle(screen, [200,255,100], [320, 320], 50, 0)

pygame.display.flip()

while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.display.quit()
sys.exit()
pygame.draw.rect(screen,
[200,200,0])

• ##### Jesse Shi
Posted at 20:52h, 11 November Reply

import pygame
pygame.init()
screen = pygame.display.set_mode([690, 690])
screen.fill([255,255,255])
pygame.draw.rect(screen, [10,50,205], [150, 150, 500, 500], 0)
pygame.draw.rect(screen, [150,150,20], [175, 175, 450, 450], 0)
pygame.draw.rect(screen, [1,250,190], [200, 200, 400, 400], 0)
pygame.draw.rect(screen, [200,195,115], [225, 225, 350, 350], 0)
pygame.draw.rect(screen, [100,150,255], [250, 250, 300, 300], 0)
pygame.draw.rect(screen, [110,50,205], [275, 275, 250, 250], 0)
pygame.draw.rect(screen, [15,200,50], [300, 300, 200, 200], 0)
pygame.draw.rect(screen, [255,20,150], [325, 325, 150, 150], 0)
pygame.draw.rect(screen, [185,235,150], [350, 350, 100, 100], 0)
pygame.draw.rect(screen, [255,250,15], [375, 375, 50, 50], 0)

pygame.display.flip()

while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.display.quit()
sys.exit()
pygame.draw.rect(screen,
[200,200,0])