Python pygame中的背景不工作
基本材料Python pygame中的背景不工作,python,pygame,Python,Pygame,基本材料 import pygame import sys import os 我认为这可能是一个问题: 在互联网上,我看到了一些带有.convert()的东西,但它一直在告诉我: AttributeError:“str”对象没有属性“convert” 当我尝试放置.conver()时 已经搜索了2个小时,我找不到这个noob的东西 ''' Objects ''' # put Python classes and functions here ''' Setup #...
import pygame
import sys
import os
我认为这可能是一个问题:
在互联网上,我看到了一些带有.convert()的东西,但它一直在告诉我:
AttributeError:“str”对象没有属性“convert”
当我尝试放置.conver()时
已经搜索了2个小时,我找不到这个noob的东西
'''
Objects
'''
# put Python classes and functions here
'''
Setup #...
'''
# put run-once code here
fps = 60
ani = 4
clock = pygame.time.Clock()
pygame.init()
或在此:
'''
Main Loop
'''
你能把代码显示在你想把
convert()。导致错误的部分丢失。没有错误,游戏只有白色背景,而不是my backgroundbackground=pygame.image.load(os.path.join('background.png').convert())
'''
Main Loop
'''
world.blit(background, (0,0))
while main == True:
for event in pygame.event.get():
if event.type == pygame.QUIT:
pygame.quit(); sys.exit()
main = False
if event.type == pygame.KEYDOWN:
if event.key == ord('q'):
pygame.quit()
sys.exit()
main = False
pygame.display.flip()
clock.tick(fps)