[Author Prev][Author Next][Thread Prev][Thread Next][Author Index][Thread Index]

Re: [pygame] resizing windows



Here's my test program:

import pygame
import os, sys
pygame.init()
screen = pygame.display.set_mode((500,500), pygame.RESIZABLE)
while 1:
    screen.fill((255,255,255))
    for event in pygame.event.get ():
        if event.type == pygame.VIDEORESIZE:
            screensize = event.size
            print screensize[0], screensize[1]
            screen = pygame.display.set_mode(event.size, pygame.RESIZABLE)
        if event.type == pygame.QUIT:
            sys.exit() 
    pygame.display.flip()

This resizes the window only after the user lets go of the mouse.  I was hoping for a way to do that too. 

On 7/2/07, Brian Fisher <brian@xxxxxxxxxxxxxxxxxxx> wrote:
sounds like you would like to use the "VIDEORESIZE" event?
http://www.pygame.org/docs/ref/event.html

I think it's something like this in your event loop:
            if event.type == VIDEORESIZE:
                screen = pygame.display.set_mode(event.size, RESIZABLE)


On 7/2/07, Ian Mallett <geometrian@xxxxxxxxx > wrote:
> Hi,
> I've made a game that could work at any screen size, but I don't know how to
> make the screen resize.  I could pass pygame.RESIZEABLE to enable users to
> resize the window, but I would need something else to resize the surface by
> calling pygame.display.set_mode().
> Geo
>