哈哈哈541888 发表于 2022-9-11 09:14:20

哪里错了(只有路径可能有问题,其他代码是别人给的)

路径# 1 - Import library
import pygame
from pygame.locals import *

# 2 - Initialize the game
pygame.init()
width, height = 640, 480
screen=pygame.display.set_mode((width, height))

# 3 - Load images
player = pygame.image.load("""llllllllllllllllllllllllllllllll\kunkun\kk.jpg""")

# 4 - keep looping through
while 1:
    # 5 - clear the screen before drawing it again
    screen.fill(0)
    # 6 - draw the screen elements
    screen.blit(player, (100,100))
    # 7 - update the screen
    pygame.display.flip()
    # 8 - loop through the events
    for event in pygame.event.get():
      # check if the event is the X button
      if event.type==pygame.QUIT:
            # if it is quit the game
            pygame.quit()
            exit(0)"D:\llllllllllllllllllllllllllllllll\kunkun\kk.jpg"

jackz007 发表于 2022-9-11 09:57:04

本帖最后由 jackz007 于 2022-9-11 09:58 编辑

      其它的事情可以变通,但是,文件路径不可马虎,差一个字符都不行!
player = pygame.image.load("D:\\llllllllllllllllllllllllllllllll\\kunkun\\kk.jpg")
页: [1]
查看完整版本: 哪里错了(只有路径可能有问题,其他代码是别人给的)