pygame error: Tuple has no attribute get_size()

239 views Asked by At

I have tried everything I can think of to get this background to work, this is the closest I have gotten as it breaks no other bits of my code. I am unsure why get_size() doesn't work.

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()

This is only a snippet of the code. I have all variables properly defined.

Please help, thanks, Cam.

3

There are 3 answers

0
AvidLearner On BEST ANSWER

Maybe this helps?

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()
0
kedam6 On
gameDisplay = pygame.display.set_mode((display_width, display_height))

Just delete second = from that line

0
Yurrili On

You should :

gameDisplay=pygame.display.set_mode([screen_width,screen_height])

Not

gameDisplay = pygame.display.set_mode = ((display_width, display_height))