kknd2310
2019-04-26 10:29用sublime写python中pygame.image.load()图片引用后不显示。
import sys
import pygame
pygame.init()
size = width,height = 320,240
screen = pygame.display.set_mode(size)
color = (0,0,0)
pic = pygame.image.load("pythonStart.png")
picrect = pic.get_reect()
while True :
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit()
sys.exit()
screen.fill(color)
screen.blit(pic,picrect)
pygame.display.flip()
##游戏框出现后一闪就没了。报错如下,请大神指教!谢谢
-------------------------------
pygame 1.9.5
Hello from the pygame community. https://www.pygame.org/contribute.html
Traceback (most recent call last):
File "F:\SublimeText\HelloSublime.py", line 8, in
pic = pygame.image.load("pythonStart.png")
pygame.error: Couldn't open pythonStart.png
[Finished in 1.9s with exit code 1]
[shell_cmd: python -u "F:\SublimeText\HelloSublime.py"]
[dir: F:\SublimeText]
[path: F:\Python\Python37;G:\pyStart;C:\Windows\system32;C:\Windows;C:\Windows\System32\Wbem;C:\Windows\System32\WindowsPowerShell\v1.0\;C:\Windows\idmu\common;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\Tools\Binn\;C:\Program Files\Microsoft SQL Server\100\DTS\Binn\;C:\Program Files (x86)\Microsoft SQL Server\100\Tools\Binn\VSShell\Common7\IDE\;C:\Program Files (x86)\Microsoft Visual Studio 9.0\Common7\IDE\PrivateAssemblies\;C:\Program Files (x86)\Microsoft SQL Server\100\DTS\Binn\;F:\Python\Python37;F:\Python\Python37\Scripts\;F:\Python\Python37]
- 点赞
- 回答
- 收藏
- 复制链接分享
2条回答
为你推荐
- 【python报错】ModuleNotFoundError: No module named 'ortools.constraint_solver'
- python
- 2个回答
- sublime text3中Package Control插件无法下载
- 开发语言
- chrome
- 1个回答
- 用Sublime写python读取txt文件
- python
- 读取文件
- 3个回答
- python 在命令行里可以运行成功,但是在sublime中运行不成功
- 3个回答
- 用sublime编辑JAVA。有中文字符出现。是这种结果(程序是对的。)
- 1个回答