亚洲在线久爱草,狠狠天天香蕉网,天天搞日日干久草,伊人亚洲日本欧美

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Python 中的 screen.fill() 命令不起作用

Python 中的 screen.fill() 命令不起作用

繁花如伊 2023-03-30 10:21:37
我有一個問題,我希望今天有人能幫助我,如果你能的話,請按照我被困住的方式去做,這里的文章告訴我,我被告知的錯誤應該有效。我正在使用 IntelliJ 的 PyCharm 和最新版本的 python - 3.8.5 所以我的目標是讓我的 PyGame 窗口變成白色,因為在啟動時它是黑色的,所以當我輸入以下代碼時會出現這個錯誤:import pygame# Initialise the pygame functions#pygame.init()# Create the screen for the user#root = pygame.display.set_mode((800, 600))pygame.display.set_caption("Space Invaders")icon = pygame.image.load("space.png")pygame.display.set_icon(icon)# Makes the pygame window appear for longer than a few milliseconds#runtime = Truewhile runtime:    for event in pygame.event.get():        if event.type == pygame.QUIT:            runtime = False    screen.fill(255, 255, 255) #The error appears here and I cant find out why because I have looked at articles and they say this should work#    pygame.display.update()PyCharm 的響應是:pygame 1.9.6Hello from the pygame community. https://www.pygame.org/contribute.htmlTraceback (most recent call last):  File "C:/Users/doesnotcompute10/OneDrive/Main Doccuments/Personal/Code/Code.PythonPycharm/PyGame/Learning/Space Invaders.py", line 25, in <module>    screen.fill(255, 255, 255)NameError: name 'screen' is not definedProcess finished with exit code 1如果有人知道如何解決,請回復和/或發送電子郵件至 [email protected]
查看完整描述

目前暫無任何回答

  • 0 回答
  • 0 關注
  • 107 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯系客服咨詢優惠詳情

幫助反饋 APP下載

慕課網APP
您的移動學習伙伴

公眾號

掃描二維碼
關注慕課網微信公眾號