How to change Pygame window name?

I am trying to change the name of the pygame window from "Pygame Window" to "test caption". I tried:

pygame.display.set_caption('test caption') 

But I do not think this is a correct script.

+6
source share
2 answers

See http://www.pygame.org/docs/ref/display.html#pygame.display.set_caption :

 set_caption(title, icontitle=None) -> None 

If the display has a window title, this function will change the name on the window. Some systems support an alternative shorter title used for minimized displays.

Your use was correct, so there should be another problem. Either your window is not initialized correctly, or it is not even initialized at all. Promoting your code would be helpful.

+2
source

Call it after init() .

 pygame.init() pygame.display.set_caption('test caption') 
+2
source

Source: https://habr.com/ru/post/1012265/


All Articles