Base.win new interface

Hello, i try to run old A3p code

I fixed some probleme with ipgetter but i have problem with base.win
theses function not work:
base.win.getPointer(0)
base.win.getProperties()
base.win.requestProperties(props)
base.win.getProperties()

these functions no longer exist and return None, I would like to know which object to call to get these functions

thanks for advance

They exist and work.

from direct.showbase.ShowBase import ShowBase

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

        print(base.win.getPointer(0))
        print(base.win.getProperties())

        props = base.win.getProperties()

        base.win.requestProperties(props)

app = Game()
app.run()
<panda3d.core.PointerData object at 0x0000014443D11D50>
origin=(560, 240) size=(800, 600) title="Panda" !undecorated !fixed_size !fullscreen foreground !minimized open !cursor_hidden absolute

the program is badly instantiated then ?
at the beginning of the code we have
base = ShowBase()

we must to code a class now ?

It doesn’t change anything.

from direct.showbase.ShowBase import ShowBase

base = ShowBase()

print(base.win.getPointer(0))
print(base.win.getProperties())

props = base.win.getProperties()
base.win.requestProperties(props)

base.run()

You didn’t say what the problem is.

i have this error (and similar for others function)

File “main.py”, line 72, in
winSize.setWord(0, base.pipe.getDisplayWidth())
AttributeError: ‘NoneType’ object has no attribute ‘getDisplayWidth’

base.pipe have None value

You are misinterpreting the error. base.win returned None, that is, the window was not created. And the method accordingly cannot be applied to None.

Although you may have a more extensive problem, it is possible that the base object was not created. Or pipe, which is more likely.

You have a problem with this, you may need to take a look at the Config.prc settings

https://docs.panda3d.org/1.10/python/programming/rendering-process/graphics-pipe

1 Like

yes i found too, i remove theses line:
if debug:
loadPrcFile(“config/config.prc”)

now it’s work !

thx for your help

I found what was causing the problem in your prc file:
window-type none

Note that if you delete the link to the configuration file that panda will use by default, you’d better delete the line prohibiting the creation of a window from the file itself.

1 Like

yes this is best solution :sweat_smile:
thx