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 = 255255255
blue = 00255
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 = 41167225
    color_black = 35,24,22
    color_green = 35,172,56
    color_yellow = 255,241,0
    color_white = 255,255,255
    position_1 = 140255
    position_2 = 250255
    position_3 = 360255
    position_4 = 195305
    position_5 = 305305
    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)
    pygame.display.update()

Comments

Popular Posts