Search code examples
panda3d

How to change the window size in Panda3D?


A Panda3D program opens with a certain window size. I cannot find any call in GraphicsWindow to set or change the window size.

How do I change the window size?


Solution

  • You can change the initial window size in your Config.prc file, OR you can prepend the following code in your main python file:

    from panda3d.core import loadPrcFileData 
      
    loadPrcFileData('', 'win-size 1024 768') 
    

    If you want to change the window size at runtime the following code should do the trick:

    w, h = 1024, 768 
    
    props = WindowProperties() 
    props.setSize(w, h) 
    
    self.win.requestProperties(props) 
    

    Hope it helps.