Python Forum

Full Version: How to get the size of resizable window?
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
I want to center things in a resizable window.

.get_rect() and pygame.display.get_surface().get_size() both always return the size of a maximized window. What else might work?

Thanks
This is what works on my system :

import pygame
pygame.init ()
screen = pygame.display.set_mode ((200, 200), pygame.RESIZABLE, 32)

while True :
	for event in pygame.event.get () :
		if event.type == pygame.VIDEORESIZE :
			print (event.size)
		if event.type == pygame.QUIT :
			quit ()
Works like a dream! Many Thanks.