print Hello world into pygame window
import pygame
import sys
from pygame.locals import *
pygame.init()
screen = pygame.display.set_mode((600, 500))
myfont = pygame.font.Font(None, 60)
white = 255, 255, 255
blue = 0, 0, 255
textImage = myfont.render("Hello World!", True, white)
while True:
for event in pygame.event.get():
if event.type in (QUIT, KEYDOWN):
sys.exit()
screen.fill(blue)
screen.blit(textImage, (140, 100))
color_blue = 41, 167, 225
color_black = 35,24,22
color_green = 35,172,56
color_yellow = 255,241,0
color_white = 255,255,255
position_1 = 140, 255
position_2 = 250, 255
position_3 = 360, 255
position_4 = 195, 305
position_5 = 305, 305
radius = 50
width = 5
# Draw a circle
pygame.draw.circle(screen, color_blue, position_1, radius, width)
pygame.draw.circle(screen, color_black, position_2, radius, width)
pygame.draw.circle(screen, color_green, position_3, radius, width)
pygame.draw.circle(screen, color_yellow, position_4, radius, width)
pygame.draw.circle(screen, color_white, position_5, radius, width)
Comments
Post a Comment