Thats it! Thanks a lot. I had to try it (print udalost), I had to be
blind :-).
gen2n
ICQ 176015287
Rene Dudfield napsal(a):
Hey.
Below is how it is done. The resize event has a size attribute.
Print the events to see what attributes they have. The size event is
also listed in the event documentation.
I have added w, h attributes to match the sdl resize event. In case
people are googling for how to find the size of a window.
Not sure how to do it without looking at the resize event though...
Have fun!
import pygame
from pygame.locals import *
velikost = 320, 240
screen = pygame.display.set_mode(velikost, RESIZABLE)
znovu=1
while znovu:
for udalost in pygame.event.get():
if udalost.type == QUIT:
znovu=0
if udalost.type== VIDEORESIZE:
# velikost=xxxxxxx # how to get the new size of my window?
print udalost
velikost = udalost.size
screen=pygame.display.set_mode(velikost, RESIZABLE)
pygame.quit()
On Mon, 14 Feb 2005 07:28:29 +0100, gen2n <gen2n@xxxxxxxxx> wrote:
Here is the snippet:
import pygame
from pygame.locals import *
velikost = 320, 240
screen = pygame.display.set_mode(velikost, RESIZABLE)
.....
znovu=1
while znovu:
for udalost in pygame.event.get():
if udalost.type == QUIT:
znovu=0
if udalost.type== VIDEORESIZE:
# velikost=xxxxxxx # how to get the new size of my window?
screen=pygame.display.set_mode(velikost, RESIZABLE)
..........
pygame.quit()
gen2n ICQ 176015287 Pavel BTW: Yeah, Kosice are quite near here in Europe.
I was there once, long time ago. Nice city.
Ben Friman napsal(a):
Pavel, I would be interested to know how you do that. Perhaps you could
show a snippet of code. One thing which doesn't answer your question but
might still be helpful, is the method for detecting the current display
resolution. I spent more hours than you could imagine trying to figure out
how to do it (under Windows only): List_Modes can give modes higher than the
current resolution! If you try to change display mode to a resolution which
is too high for the display device, the user doesn't get to see a lot! So
it's much safer to detect the current display resolution and work within
that. import win32api SM_CXSCREEN = 0 # I didn't find any include file which
defines these contstants SM_CYSCREEN = 1 x =
win32api.GetSystemMetrics(SM_CXSCREEN) y =
win32api.GetSystemMetrics(SM_CYSCREEN) Incidentally, my father was called
Pavel and he came from Kosice. I guess that's somewhere near to you!
I have tried to make my window resizable. It works just a half. I was even
able to catch that event but no idea how to get a size of a new window, so I
can resetÿ atributes of a window with pygame.display.set_mode(size). Thanks
a lot Pavel -- gen2n ICQ 176015287
|