0
import pygame, sys
from pygame.locals import *

BLACK = ( 0, 0, 0)
WHITE = (255, 255, 255)
GREEN = (0, 255, 0)
RED = ( 255, 0, 0)


pygame.init()
size = (700, 500)
screen = pygame.display.set_mode(size)


DISPLAYSURF = pygame.display.set_mode((400, 300))
pygame.display.set_caption('P.Earth')
while 1: # main game loop
     for event in pygame.event.get():
        if event.type == QUIT:

            pygame.display.update()

import time

direction = ''

print('Welcome to Earth')
pygame.draw.circ(screen, RED, [55,500,10,5], 0)
time.sleep(1)
print('Earth was a very prosperous planet. Filled with life and culture.')
time.sleep(2)

This is only a part of it. It doesn't display on the pygame screen. (in case you're wondering i do use pygame.quit() at the end) I just want it to work. If you could make your answers simpler, that'd be great because i'm still a beginner. How would i display the text? any help will do. thanks.

Slater Victoroff
  • 21,376
  • 21
  • 85
  • 144
user3146817
  • 697
  • 1
  • 5
  • 9

1 Answers1

1

You're looking to use the pygame font module.

Here's an example of rendering then positioning the font on your screen. ()

import pygame.font

font = pygame.font.Font(None, 36) # None can be a font file instead
text = font.render("Welcome to Earth", 1, (0, 0, 0))
# Determine the location that should be allocated for the text
text_box = text.get_rect(centerx=DISPLAYSURF.get_width()/2)
# Draw the text onto the background
background.blit(text, text_box)
Slater Victoroff
  • 21,376
  • 21
  • 85
  • 144