Aspect2d and directstart

I received the following warning runing the directbutton example,

Using deprecated DirectStart interface.

No problem i searched for it in help and found that i should use

from direct.showbase.ShowBase import ShowBase
base = ShowBase()

I did that, and then got an error

    Traceback (most recent call last):
      File "", line 10, in <module>
        textObject = OnscreenText(text=bk_text, pos=(0.95,-0.95), scale=0.07,
      File "/usr/share/panda3d/direct/gui/", line 108, in __init__
        parent = aspect2d
    NameError: name 'aspect2d' is not defined

searching for aspect2d gave me a lot of hits and i can’t sort out what i need to do…

I suspect you have an outdated version of Panda3D. Which version do you have?

i’m installing 1.10.9 right now…
and… i’m in dependency hell.
dpkg: dependency problems prevent configuration of panda3d1.10:
panda3d1.10 depends on libopenexr25 (>= 2.5.3); however:
Package libopenexr25 is not installed.

Package libopenexr25 is not available, but is referred to by another package.
This may mean that the package is missing, has been obsoleted, or
is only available from another source

Ok. problem is i’m running linux mint and it appears to be on focal, i.e. ubuntu 20.04.
so i can’t use the latest version of panda3d.

oh good grief. lol. there is a panda 1.10.9 package for focal. i just installed it and it works !

running it required a small modification. I have included the entire script just in case anyone finds it useful.

#import direct.directbase.DirectStart
from direct.showbase.ShowBase import ShowBase
from direct.gui.OnscreenText import OnscreenText
from direct.gui.DirectGui import *

from panda3d.core import TextNode

# Add some text
bk_text = "This is my Demo"
textObject = OnscreenText(text=bk_text, pos=(0.95,-0.95), scale=0.07,
                          fg=(1, 0.5, 0.5, 1), align=TextNode.ACenter,

# Callback function to set  text
def setText():
        bk_text = "Button Clicked"

# Add button
b = DirectButton(text=("OK", "click!", "rolling over", "disabled"),
                 scale=.05, command=setText)

# Run the tutorial
base = ShowBase()

Should there be two copies of “base = ShowBase()” and “” in that script?

Thank you for pointing out the error.


cut and paste gone wrong, of course…

1 Like