windowProperties and displayRegion

        for idx in range( info.getTotalDisplayModes( ) ):
            width  = info.getDisplayModeWidth( idx ) 
            height = info.getDisplayModeHeight( idx ) 
            bits   = info.getDisplayModeBitsPerPixel( idx ) 
            self.winResW = info.getMaximumWindowWidth()
            self.winResH = info.getMaximumWindowHeight()

        self.winProp = WindowProperties() 
        self.winProp.setSize(self.winResW-100, self.winResH-100)
        self.winProp.setTitle("Happy Frog")

I used this code to adjust the window size based on the user’s screen resolution. However, when i did this, my displayRegion is slightly smaller than it was originally, and my buttons (gui) shifted slightly to the left. How can I correct this so it does not occur whatever the size of the window might be?

I asked for help on a similar subject in this thread Maybe it helps you too in some degree.

Thanks for replying.
Yes, I had seen that thread, but my GUI is made up of .egg files, and I don’t want them parented to 2d because they lose 3d quality. Is there something else I can do?

Put this line in your Config.prc file:

aspect-ratio 1.3333

This tells Panda that you want to always use the same fixed aspect ratio, regardless of the shape of your window. This disables Panda’s automatic aspect-ratio correction, and means that the graphics within your window will stretch and squash to fit the window, as you change its size.

You could, of course, use any value of aspect-ratio you like. The value 1.3333 is 4/3, which is appropriate for a typical 4:3 aspect window. If you go widescreen like 16:9, you could put in 1.7777 instead.


That fixed it!
Thank you very much D.