pygame error: Tuple has no attribute get_size()
pygame error: Tuple has no attribute get_size()
我已经尝试了所有我能想到的方法来让这个背景发挥作用,这是我得到的最接近的,因为它没有破坏我的代码的其他部分。我不确定为什么 get_size() 不起作用。
gameDisplay = pygame.display.set_mode = ((display_width, display_height))
myFont = pygame.font.SysFont("monospace", 15)
pygame.display.set_caption("Catastrophee")
background = pygame.Surface(gameDisplay.get_size())
background = background.convert()
这只是一小段代码。我已正确定义所有变量。
请帮忙,
谢谢,卡姆。
也许这有帮助?
gameDisplay = pygame.display.set_mode((display_width, display_height)) #removed =
myFont = pygame.font.SysFont("monospace", 15)
pygame.display.set_caption("Catastrophee")
background = pygame.Surface(gameDisplay.get_size())
background = background.convert()
gameDisplay = pygame.display.set_mode((display_width, display_height))
只需从该行删除第二个 =
你应该:
gameDisplay=pygame.display.set_mode([screen_width,screen_height])
没有
gameDisplay = pygame.display.set_mode = ((display_width, display_height))
我已经尝试了所有我能想到的方法来让这个背景发挥作用,这是我得到的最接近的,因为它没有破坏我的代码的其他部分。我不确定为什么 get_size() 不起作用。
gameDisplay = pygame.display.set_mode = ((display_width, display_height))
myFont = pygame.font.SysFont("monospace", 15)
pygame.display.set_caption("Catastrophee")
background = pygame.Surface(gameDisplay.get_size())
background = background.convert()
这只是一小段代码。我已正确定义所有变量。
请帮忙, 谢谢,卡姆。
也许这有帮助?
gameDisplay = pygame.display.set_mode((display_width, display_height)) #removed =
myFont = pygame.font.SysFont("monospace", 15)
pygame.display.set_caption("Catastrophee")
background = pygame.Surface(gameDisplay.get_size())
background = background.convert()
gameDisplay = pygame.display.set_mode((display_width, display_height))
只需从该行删除第二个 =
你应该:
gameDisplay=pygame.display.set_mode([screen_width,screen_height])
没有
gameDisplay = pygame.display.set_mode = ((display_width, display_height))