if score == 10:
myFont = pygame.font.SysFont("times new roman ", 35)
white = (255,255,255)
text2 = ("You win! Congrats!")
label2 = myFont.render(text2, 1, white)
text_width = text2.get_width()
screen.blit(label2, (text2_width, height/2))
pygame.display.update()
time.sleep(3)
game_over = True
break
I want to get this text in the middle of my pygame screen, but I can't get the text's width. Python gives error ''string' object has no attribute 'get_width''. Does anyone have another way to do this? I also need the height's length, so if you included how to get that too that would be great.