Forcing widescreen

Hi, I would like to force my application to run widescreen (16:9) even if its window has another ratio. I’ve this code:

import direct.directbase.DirectStart 
base.disableMouse() 
camera.setPosHpr( ( 20, -20, 15 ), ( 45, -18.5, 0 ) ) 
loader.loadModel( 'panda' ).reparentTo( render )

def onResize():
  wp = base.win.getProperties() 
  dy = .28 * wp.getXSize() / wp.getYSize()
  for d in base.win.getDisplayRegions():
    d.setDimensions( 0, 1, .5 - dy, .5 + dy )
  base.camLens.setAspectRatio( 1.7777 )

base.accept( 'aspectRatioChanged', onResize )
run()

At the beginning it works correctly, since I obtain this:

Then I would like to “preserve” the black bars (if needed i.e. if the aspect ratio is less than 16:9) every time I resize my window, but I can’t “clear” the areas outside the display regions, indeed I obtain this for example (with some resizes):

How can I solve this, obtaining “the black bars” every time I resize? Thank you!

Create another DisplayRegion, behind the main one, that covers the whole window and clears to black.

David

Thank you!