I've encoutered the following bug.

When handling a VideoResize event, I change the display size using
pygame.display.set_mode. After that, it seems (most of the time) subsequent
video resize events are not returned by pygame.event.get

Play with window  see see how sometimes events are generated, sometimes
not. It seems that when only stretching the window horizontally or
vertically, all events are processed, but when stretching horizontally and
vertically at the same time (e.g. when you drag a corner of the window)
events are not processed.

Note that if the call to display.set_mode is commented out, all resize
events are returned by event.get (but the display surface is not resized,
so the application is functionally broken).

System: Xubutu 18.04
Python version: 3.6.8
Pygame version: 1.9.6 (via pip3)

Example code:

import pygame
> import time
> import random
>
> pygame.init()
>
> surface = pygame.display.set_mode((600,400), pygame.RESIZABLE)
>
> quit = False
> while (not quit):
>     for event in pygame.event.get():
>         #quit event
>         if event.type == pygame.QUIT:
>             quit = True
>         #escape key (also quit)
>         elif event.type == pygame.KEYDOWN:
>             if event.key == pygame.K_ESCAPE:
>                 quit = True
>         # resize event
>         elif event.type == pygame.VIDEORESIZE:
>             print("resize event",event)
>             # LOOK: here is the problem: calling dispay.set_mode, seems to
> block future resize events!
>             surface = pygame.display.set_mode((event.w,event.h),
> pygame.RESIZABLE)
>             # fill with random color to visualize the problem
>             col =
> (random.randint(0,255),random.randint(0,255),random.randint(0,255))
>             surface.fill(col, (0,0,event.w,event.h))
>             pygame.display.update()
>         #endif
>     #endfor
> #endwhile
>


-- 
e-mail: rickvandermei...@gmail.com

Reply via email to