I'm trying to just draw any text on to the screen in pygame but when I run the program it just runs normally but no text appears on the screen. Is there something I'm doing wrong?
import pygame, random, sys
from pygame.locals import *
pygame.init()
#set constants
WINDOWWIDTH = 600
WINDOWHEIGHT = 600
TEXTCOLOR = (255, 255, 255)
BACKGROUNDCOLOR = (0, 0, 255)
FPS = 40
BLACK = (0,0,0)
RED = (255, 0, 0)
WHITE = (255, 255, 255)
#set variables
rectY1 = 200
rectY2 = 200
Y1change = 0
Y2change = 0
ballX = 320
ballY = 240
ballXvel = 0
ballYvel = 0
paddle1 = pygame.Rect(18,rectY1,10,100)
paddle2 = pygame.Rect(620,rectY2,10,100)
ball = pygame.Rect(ballX,ballY,30,30)
font = pygame.font.SysFont(None, 48)
#create shapes
def drawshapes():
pygame.draw.rect(DISPLAY, WHITE, paddle1)
pygame.draw.rect(DISPLAY, WHITE, paddle2)
pygame.draw.rect(DISPLAY, WHITE, ball)
def drawText(text, font, surface, x, y):
textobj = font.render(text, 1, TEXTCOLOR)
textrect = textobj.get_rect()
textrect.topleft = (x, y)
surface.blit(textobj, textrect)
#set up display
DISPLAY = pygame.display.set_mode((640,480),0,32)
pygame.display.set_caption('Pong')
fpsClock = pygame.time.Clock()
drawText('bruh', font, DISPLAY, (200), (200))
pygame.display.update