Pygame draw function isn't drawing anything

Question:
When I try to use the pygame draw function to draw a rectangle for the user to move, it doesn’t show up. Please help!

Repl Link:
https://replit.com/@GbemisolaOlabod/Iteration-and-Build#main.py

code snippet:

def draw(player):
   WIN.blit(BG, (0, 0))
 
   pygame.draw.rect(WIN, "red", player)

   pygame.display.update()

def main():
  run = True
  
  player = pygame.Rect(80, HEIGHT - PLAYER_HEIGHT, PLAYER_WIDTH, PLAYER_HEIGHT)

Your pygame window is so tall that the bottom is cut off.
With some screen manipulation, I see that the rectangle is actually being drawn but out of view.
I’d recommend changing the screen dimensions and/or rotating all of your stuff 90 degrees.

1 Like

Thank you, that really helped!

you can mark my post as solution

This topic was automatically closed 7 days after the last reply. New replies are no longer allowed.