import pygame
import random
WIDTH = 500
HEIGHT = 500
FPS = 60
WHITE = (255, 255, 255)
BLACK = (0, 0, 0)
RED = (255, 0, 0)
GREEN = (0, 255, 0)
BLUE = (0, 0, 255)
pygame.init()
screen = pygame.display.set_mode((WIDTH, HEIGHT))
running = True
size = 20
while running:
screen.fill(WHITE)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.MOUSEBUTTONDOWN:
if event.button == 1:
size += 5
font = pygame.font.Font(None, size)
img = font.render("Hello world", True, BLUE)
screen.blit(img, (50,250))
pygame.display.update()
pygame.quit()
|