Panda3D launches with black screen

#import statements go here
#showbase is used to display the Panda3D window to the user
from direct.showbase.ShowBase import ShowBase
#window properties is used to decide the size and other
#miscellaneous properties of the windows
from panda3d.core import WindowProperties
#screen info is used to detect the size of the user's
#monitor so that the window is appropriately sized
#only get_monitors is installed because that is the only module used
from screeninfo import get_monitors
#directGUI is used to create the menu for the game
from direct.gui.DirectGui import *
import time
from direct.actor.Actor import Actor

#Game is the class that contains/ will contain most of the game's framework e.g arena, physics
#It is also the first class used upon starting the game
class Game(ShowBase):
    def __init__ (self):
        #ShowBase loads most of Panda3D modules
        #Here, it loads the window the game is displayed on
        ShowBase.__init__ (self)
       
        WindowSize = WindowProperties()
        WindowSize.setSize(768,1366)
        self.win.requestProperties(WindowSize)

        # Move the camera to a position high above the screen
        # --that is, offset it along the z-axis.
        self.camera.setPos(0, 0, 32)
        # Tilt the camera down by setting its pitch.
        self.camera.setP(-90)

#runGame will be the first process to run, as it starts the game
runGame = Game()
runGame.run

When I run this code, the screen doesn’t adjust, and there’s just a black screen (of the incorrect resolution).
I get this error message:

C:\Users\User\OneDrive\Documents\My Code\Panda3>python Panda3Game.py
Known pipe types:
  wdxGraphicsPipe9
(all display modules loaded.)
AL lib: (EE) ALCwasapiPlayback_open: Device init failed: 0x80070490
AL lib: (EE) ALCwasapiPlayback_open: Device init failed: 0x80070490
:audio(error): Couldn't open default OpenAL device
:audio(error): OpenALAudioManager: No open device or context
:audio(error):   OpenALAudioManager is not valid, will use NullAudioManager
AL lib: (EE) ALCwasapiPlayback_open: Device init failed: 0x80070490
AL lib: (EE) ALCwasapiPlayback_open: Device init failed: 0x80070490
:audio(error): Couldn't open default OpenAL device
:audio(error): OpenALAudioManager: No open device or context
:audio(error):   OpenALAudioManager is not valid, will use NullAudioManager
:display:wdxdisplay9(warning): ID3D9 released but still has a non-zero refcnt(1), multi-releasing it down to zero!

C:\Users\User\OneDrive\Documents\My Code\Panda3>

I have other Panda3D code that works correctly, so I’m not sure what’s going wrong.

Greetings, and welcome to the forum! :slight_smile:

As to your problem:

Well, your last line doesn’t actually call “run”–it just accesses the method, as though to store a reference to it. (That is, there are no brackets after “runGame.run”.)

That, at least, is the only thing that I see offhand that might be a problem. (But then, I’m not familiar with the “screeninfo” module.)

1 Like

Thank you very much, that fixed it

1 Like