Answer the question
In order to leave comments, you need to log in
Argument 1 must be pygame.Surface, not None how to decide?
Help solve the problem. Here is the error code: Traceback (most recent call last):
File "D:\Python\Pigs, escape from the farm\test.py", line 21, in
pygame.draw.rect(win, (0,0,255), ( x, y, width, height))
TypeError: argument 1 must be pygame.Surface, not None
import pygame
pygame.init()
win = pygame.display.set_mode((500, 500))
win = pygame.display.set_caption('Cubes Game')
x = 50
y = 50
width = 40
height = 60
speed = 5
run = True
while run:
pygame.time.delay(100)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
pygame.draw.rect(win, (0,0,255), (x, y, width, height))
pygame.display.update()
pygame.quit()
Answer the question
In order to leave comments, you need to log in
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question