python.pygame中导入图片打不开原因
#_*_coding:utf-8_*_
import sys
import pygame
pygame.init()
size=width,height=640,480
screen=pygame.display.set_mode(size)
color=(0,0,0)
ball=pygame.image.load("ball.png")
ballrect=ball.get_rect()
while Ture:
for event in pygame.event.get():
if event.type==pygame.QUIT:
sys.exit()
screen.fill(color)
screen.blit(ball,ballrect)
pygame.display.flip()
pygame.quit()
错误编译:
Traceback (most recent call last):
File "C:\Program Files\Python37\ball\ball.py.py", line 10, in <module>
ball=pygame.image.load("ball.png")
pygame.error: Couldn't open ball.png