while game: for event in pygame.event.get(): if event == pygame.QUIT: pygame.QUIT quit() display.fill((0,0,255)) run_game()
Вывод: pygame 2.1.2 (SDL 2.0.18, Python 3.10.4) Hello from the pygame community. https://www.pygame.org/contribute.html Traceback (most recent call last): File "C:\Users\Admin\Desktop\Dino\Dino.py", line 19, in <module> run_game() File "C:\Users\Admin\Desktop\Dino\Dino.py", line 18, in run_game display.fill((0,0,255)) NameError: name 'display' is not defined
Пробовал пишет нет такого атрибута: AttributeError: module 'pygame.display' has no attribute 'fill'
Андрей Соколов
Мыслитель
(9186)
Егор Ларионов, лол, дак всмысле? А почему ты вообще тогда пытаешься его заюзать? Это как подойти к манекену и сказать: роди мне ребёнка. Кто тебе вообще сказал что у него есть такая функция? Откуда ты это взял?
Код:
import pygame
pygame.init()
dis_vight = 800
dis_height = 600
dis = pygame.display.set_mode((dis_vight, dis_height))
def run_game():
game = True
while game:
for event in pygame.event.get():
if event == pygame.QUIT:
pygame.QUIT
quit()
display.fill((0,0,255))
run_game()
Вывод:
pygame 2.1.2 (SDL 2.0.18, Python 3.10.4)
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "C:\Users\Admin\Desktop\Dino\Dino.py", line 19, in <module>
run_game()
File "C:\Users\Admin\Desktop\Dino\Dino.py", line 18, in run_game
display.fill((0,0,255))
NameError: name 'display' is not defined