Just started a Python course at my school, and our first assignment requires us to write out text on multiple lines. I still cannot figure out how to do so with my code so if anyone could help, that'd be great. Code posted below.
import pygame, sys
from pygame.locals import *
pygame.init()
pygame.display.set_caption('font example')
size = [640, 480]
screen = pygame.display.set_mode(size)
clock = pygame.time.Clock()
myfont = pygame.font.SysFont(None, 48)
text = myfont.render('My Name', True, (0, 0, 0), (255, 255, 255))
textrect = text.get_rect()
textrect.centerx = screen.get_rect().centerx
textrect.centery = screen.get_rect().centery
screen.fill((255, 255, 255))
screen.blit(text, textrect)
pygame.display.update()
while True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
clock.tick(20)