Python Forum
[PyGame] How to get the size of resizable window?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
[PyGame] How to get the size of resizable window?
#1
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
Reply
#2
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 ()
nilamo and michael1789 like this post
Reply
#3
Works like a dream! Many Thanks.
Reply


Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020