【发布时间】:2020-08-30 13:33:02
【问题描述】:
这里是代码
import pygame
pygame.init()
screen_width = 480
screen_height = 640
screen = pygame.display.set_mode((screen_width, screen_height))
background = pygame.image.load("D:/Python/Pygame_200830/Background.png")
running = True
while running:
for event in pygame.event.get():
if event.type == pygame.QUIT:
running = False
#screen.fill((0, 0, 255))
screen.blit(background, (0, 0))
pygame.display.update()
pygame.quit()
如果我用 VS 代码打开它,它工作得很好,但是当我用 Pycham 做这个时。我看不到“backgound.png”
只是黑屏而已……唯一的区别是IDE程序。
我已经添加了外部功能或其他东西......只有那个背景是问题。
你能告诉我是什么原因吗...?
【问题讨论】:
-
你是在虚拟环境中做的吗?