getMaximumWindowWidth returning 0

Hey everyone, I’m having an issue with a function in Panda3d… It seems to return 0 for no apparent reason.
I’ve tried replicating the issue with a simplified piece of code, which produces the result I was receiving. Thanks for any help!

from direct.showbase.ShowBase import ShowBase

class testingDisplays(ShowBase):
    
    def __init__(self):
        ShowBase.__init__(self)

        displayInfo = base.pipe.getDisplayInformation()
        maxScreenWidth = displayInfo.getMaximumWindowWidth()
        
        # Returns zero...?
        print maxScreenWidth


testingDisplays()

It seems this function isn’t implemented everywhere. It only seems to be implemented on Windows when setting “request-dxdisplay-information true” in Config.prc, but I don’t recommend setting it as it will slow down the startup process.

What exactly are you after? Perhaps base.pipe.getDisplayWidth() is more useful?

Thank you rdb! I do have one question, does this also work on macOS? I have tested it out on Windows and Linux and it works perfectly, however I do not have any access to a Mac machine. Thanks!

base.pipe.getDisplayWidth() also works on macOS.