I'm very new to coding. I can't figure out why the image won't display. The image is in the correct folder, and I'm using pygame.display.update(), so I don't understand why it won't show up. When I run the program, the screen turns green, but nothing else happens.
Here's the area I'm having the problem with:
run = True
while run:
display.fill(green)
message_display('yoyo')
pygame.display.update()
time.sleep(2)
display.blit(image, (width, height))
pygame.display.update()
time.sleep(2)
Here's the full code, if needed:
import pygame
import time
pygame.init()
black = (255, 255, 255)
white = (0, 0, 0)
blue = (108, 201, 245)
red = (235, 38, 38)
green = (52, 163, 84)
height = 800
width = 600
display = pygame.display.set_mode((width, height), 0, 32)
image = pygame.image.load('alvin.jpg')
def text_objects(text, font):
textSurface = font.render(text, True, black)
return textSurface, textSurface.get_rect()
def message_display(text):
largeText = pygame.font.Font('freesansbold.ttf',115)
TextSurf, TextRect = text_objects(text, largeText)
TextRect.center = ((width/2),(height/2))
display.blit(TextSurf, TextRect)
pygame.display.update()
time.sleep(2)
run = True
while run:
display.fill(green)
message_display('yoyo')
pygame.display.update()
time.sleep(2)
display.blit(image, (width, height))
pygame.display.update()
time.sleep(2)
Thanks!