【发布时间】:2019-02-03 23:02:21
【问题描述】:
我目前正在使用 Pygame 开发一款游戏,但我在一个非常简单的程序上遇到了一个奇怪的错误
import os, sys, math, time, random, pygame
sys.path.append(os.path.abspath('../lib')) # The program add the folder 'lib' in importable packages
import logs
from constants import *
from definitions import *
pygame.init()
background = pygame.image.load("bg1.png").convert
inProgress = True
a = 1
while inProgress:
screen.blit(background, (0,0))
DrawBar(barPos, barSize, borderColor, Very_Light_Blue, (2*a)/max_a)
a = a + 1
if a > max_a:
a = max_a
for event in pygame.event.get():
if event.type == pygame.quit:
inProgess = False
pygame.display.update()
pygame.quit()
但是回溯告诉我: ' 屏幕中的 14(背景(0,0)),'背景'需要是 Pygame.surface 而不是函数或字典' 有点奇怪... 你能帮帮我吗?
【问题讨论】:
-
.convert应该是.convert()吗? -
我,我他妈的傻xD
-
容易出错:)
标签: python pygame python-3.7