Answer the question
In order to leave comments, you need to log in
AttributeError: module 'pygame' has no attribute 'display' What should I do?
import pygame
win = pygame.display.set_mode((500,500))
pygame.display.set_caption('Ghost house')
y=50
x = 50
widht = 40
height = 60
speed = 5
run = trye
while run:
pygame.time.delay(500)
for event in pygame.event.get():
if event.type == pygame.QUIT:
run = False
keys = pygame.key.get_pressed()
if keys [pygame.K_LEFT]:
x -= speed
if keys [pygame.K_RIGHT]:
x += speed
if keys [pygame.K_UP]:
y -= speed
if keys [pygame.K_DOWN]:
y += speed
pygame.draw.rect(win, (0,255,0), (x,y,width,height))
pygame.display.update
Answer the question
In order to leave comments, you need to log in
Maybe display is a function? Then you need to call it as a function - display ().
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question