【发布时间】:2020-11-13 16:08:19
【问题描述】:
如您所见,我正在尝试在我的程序中添加 .png 图像,但是当我尝试时它显示错误
解释器显示以下错误-
加载图片时出错
使用 VS 代码的标准文本/二进制/编辑器打开文件?
import pygame
#initialize pygame
pygame.init()
#create the game screen
screen = pygame.display.set_mode((800,600))
# title and icon
pygame.display.set_caption("space invaders")
icon = pygame.image.load('spaceship.png')
pygame.display.set_icon(icon)
# game loop
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
【问题讨论】:
标签: python python-3.x