1
import pygame

pygame.init()  
display_width = 800   
display_height = 600

black = (0, 0, 0)  
white = (255, 255, 255)

gameDisplay = pygame.display.set_mode((display_width, 
display_height))  
pygame.display.set_caption("antboi")
clock = pygame.time.Clock()
boiImg = pygame.image.load("antwhite.png").convert()


def boi(x, y):
    gameDisplay.blit(boiImg, (x, y)) 


x = (display_width * 0)
y = (display_height * 0.3)

crashed = False

while not crashed:
    for event in pygame.event.get():
        if event.type == pygame.QUIT:
            crashed = True

    gameDisplay.fill(white)  
    boi(x, y)
    pygame.display.update()  
    clock.tick(60)  # set FPS

I'm new to pygame, using python 3.7 and pygame 1.9 on a mac. I can't get anything to display correctly when i run this, including the background fill and the pygame.image.load file (the file is in the same location as the script).. Please help!

chromedrip
  • 11
  • 2
  • Does the window just display with a black screen? Are you able to close the window? – user2379875 Oct 11 '18 at 21:09
  • Yes, the window just appears black. I'm able to close the window – chromedrip Oct 12 '18 at 00:15
  • The code should actually work. There are quite a lot of mac users who have similar problems. Maybe something is wrong with pygame or it wasn't installed correctly? How did you install pygame and is it the most recent version (1.9.4)? – skrx Oct 12 '18 at 08:06
  • I used the brew command to install python with Homebrew and everything looked like it installed properly, very weird.. pygame is the most recent version as well – chromedrip Oct 12 '18 at 18:40
  • 1
    Just figured it out - the image was too large and it was only displaying the black border around it.. – chromedrip Oct 12 '18 at 18:56

0 Answers0