前提・実現したいこと
pygameのライブラリで画像を表示するソースコードを打つとエラーが発生する。
発生している問題・エラーメッセージ
C:\Users\kaito\python\game\画面設定>python 背景.py pygame 1.9.4 Hello from the pygame community. https://www.pygame.org/contribute.html Traceback (most recent call last): File "背景.py", line 27, in <module> main() File "背景.py", line 10, in main bg=pygame.image.load('Pictures/gasshu.jpg') pygame.error: Couldn't open Pictures/gasshu.jpg
該当のソースコード
python:エラー
import pygame from pygame.locals import * import sys def main(): pygame.init() screen=pygame.display.set_mode((500,637)) pygame.display.set_caption('Pygame Test') bg=pygame.image.load('Pictures/gasshu.jpg') rext_bg=bg.get_rect() while(True): screen.fill((0,0,0,0)) screen.blit(bg,rect_bg) pygame.time.wait(30) pygame.display.update() for event in pygame.event.get(): if event.tyape==QUIT: pygame.quit() sys.exit() if event.type==KEYDOWN: pygame.quit() sys.exit() if __name__ == '__main__': main()
。
まだ回答がついていません
会員登録して回答してみよう