bif="bg.jpeg"
mif="ball.png"
import pygame
import sys
from pygame.locals import *
pygame.init()
screen_size=(640, 360)
screen=pygame.display.set_mode( screen_size, 0, 32)
background=pygame.image.load(bif).convert()
mouse_c=pygame.image.load(bif).convert_alpha()
while (True):
for event in pygame.event.get():
if event.type == QUIT:
pygame.quit()
sys.exit()
screen.blit(background, (0,0) )
x,y = pygame.mouse.get_pos()
x -=mouse_c.get_width()/2
y -=mouse_c.get_height()/2
screeb.blit(mouse_c, (x,y) )
pygame.display.update()
回溯(最近一次通话最后):
文件“C:\Users\Ofek\Desktop\game\try.py”,第 12 行,在
背景=pygame.image.load(bif).convert()
pygame.error: 无法打开 C:\Users\Ofek\Desktop\game\bg.jpeg