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

Re: [pygame] help: problem with pygame.display.get_surface



do you get what you want if you change the display resolution to match
the window? (see below)
----
import pygame
screen = pygame.display.set_mode((800,600), pygame.RESIZABLE)
while 1:
   event = pygame.event.wait()
   if event.type == pygame.VIDEORESIZE:
     print event
     screen = pygame.display.set_mode(event.size, pygame.RESIZABLE)
     print pygame.display.get_surface()
   if event.type == pygame.QUIT:
      break


On 10/12/07, inhahe <inhahe@xxxxxxxxx> wrote:
> I'm having a problem here.  I want to get a new surface when I resize
> a window so that I have access to the entire window, if it's bigger.
> So I figured screen = pygame.display.get_surface() is the way.  But
> it's not working.  it's giving me a surface with the same dimensions
> as the display before it's resized.  Here's some minimal code that
> shows the problem:
>
> import pygame
> screen = pygame.display.set_mode((800,600), pygame.RESIZABLE)
> while 1:
>     event = pygame.event.wait()
>     if event.type == pygame.VIDEORESIZE:
>       print event
>       print pygame.display.get_surface()
>
>
> the printout of event shows the new dimensions of the display, and
> pygame.display.get_surface() is returning a surface with the old
> dimensions.
>
> OS: Windows XP SP2
> Python: 2.5.1
> pygame: 1.7.1release
>
>
> Is this a bug, or am I doing it wrong, and is there any other way to do this?
>