0

So, I'm trying to experiment with Pygame and have a simple program to render a cube at an X and Y position (currently 0,0). However, no matter where I choose to render this object, it will not render whatsoever.

Quite simply, I have this program:

import pygame
import sys
pygame.init

size = width, height = 840,840
black = (0,0,0)
blue=(0,0,255)
white = (250,250,250)
x = 0
y = 0
dis = pygame.display.set_mode(size)

while True:
    for event in pygame.event.get():
        if event.type == pygame.QUIT: sys.exit()
    pygame.draw.rect(dis,blue,[x,y,10,10])
    pygame.display.update

and it should render a rectangle at 0,0. However, it does not render an object at all, and I have checked everything tons of times. No errors, it just doesn't render a cube.

Rabbid76
  • 202,892
  • 27
  • 131
  • 174
Fuery
  • 33
  • 6
  • There are multiple places here where parentheses are missing from a function call. You **can not** omit them simply because there are no arguments for the call. This does not call the function. Please see the linked duplicate. (In fact, you should already understand this, because you correctly wrote e.g. `sys.exit()`, and not `sys.exit`. The same reasoning applies to `pygame.init` and `pygame.display.update`.) – Karl Knechtel Mar 11 '23 at 06:01

0 Answers0