import pygame
import random
WIDTH = 500
HEIGHT = 700
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))
font = pygame.font.Font(None, 36)
running = True
pygame.time.set_timer(pygame.USEREVENT, 100)
offset = 0
while running:
screen.fill(WHITE)
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
if event.type == pygame.USEREVENT:
offset = offset + 10
for it_1 in range(0,500,50):
img = font.render("Hello world", True, BLUE)
screen.blit(img, (it_1%50+offset,it_1))
pygame.display.update()
pygame.quit()
|