这是我的代码
import pygame
pygame.init()
class Tiles:
size = 32
def Load_Texture(file, size):
bitmap = pygame.image.load(file)
bitmap = pygame.transform.scale(bitmap, (size, size))
surface = pygame.surface((size, size), pygame.HWSURFACE|pygame.SRCALPHA)
surface.blit(bitmap, (0, 0))
return surface
grass = Load_Texture("graphs\\grass.png", size)
stone = Load_Texture("graphs\\stone.png", size)
water = Load_Texture("graphs\\water.png", size)
这是错误报告
PS C:\Users\shuyi\Desktop\Programming\Python\RPG> & python c:/Users/shuyi/Desktop/Programming/Python/RPG/scripts/textures.py
Traceback (most recent call last):
File "c:/Users/shuyi/Desktop/Programming/Python/RPG/scripts/textures.py", line 5, in <module>
class Tiles:
File "c:/Users/shuyi/Desktop/Programming/Python/RPG/scripts/textures.py", line 16, in Tiles
grass = Load_Texture("graphs\\grass.png", size)
File "c:/Users/shuyi/Desktop/Programming/Python/RPG/scripts/textures.py", line 12, in Load_Texture
surface = pygame.surface((size, size), pygame.HWSURFACE|pygame.SRCALPHA)
TypeError: 'module' object is not callable
PS C:\Users\shuyi\Desktop\Programming\Python\RPG>
我不明白为什么会收到此错误:(
任何人都可以帮我解释一下吗?我无法在网上找到合适的解决方案