Windows resize

I’ve got a question about the eternal problem of keeping aspect2d ratio while resizing window.:smiley:

I created a little code that work perfectly under linux, no worries.
But under windows, there is a bug. If i resize the window, nothing works ( it is still going through my code.) But if I move the window ( or lose focus, gain focus, etc… ) everything returns to normal.

As if there were a resizing function after my code that breaks everything.

Does that ring a bell anyone ?

class WindowHandler(DirectObject):
    def __init__(self):
        self.accept('window-event', self.first_activation)

    def first_activation(self,win):
        x = win.getXSize()
        y = win.getYSize()
        self.ratio2d = aspect2d.getScale()[0] , aspect2d.getScale()[1]
        self.first_size = x,y
        self.ratioX = x /float(
        self.ratioY = y /float(
        self.accept('window-event', self.resize_window)

    def resize_window(self,win):
        x = win.getXSize()
        y = win.getYSize()
        self.size = (x,y)

    def resize_aspect2d(self):
        scaleX = self.ratio2d[0] * self.first_size[0] / float(self.size[0])
        scaleY = self.ratio2d[1] * self.first_size[1] / float(self.size[1])

I finally find a hack that make the window correctly resized, but it’s really ugly:'event_temp')
        self.accept('window-event', self.resize_window)

    def window_event_temp(self,win):

    def resize_window(self,win=None):
        x =
        y =

The [1,] parameter is the key, if i pass win as argument, nothing change ( I 've still got the bad resize ) , but i supposed that the window handler try to do thing with the window passed in parameter, so i sent it a bad one, and i still do that i should, acceding the window with