Hi! I was just wondering what library I need to import so I can run text nodes and/or where I can find the library for aspect2d. Thank you. Also I’m using Python. I’m just playing around with things, so this is all Panda code.
from direct.showbase.ShowBase import ShowBase
from direct.gui.OnscreenText import OnscreenText
from direct.gui.OnscreenImage import OnscreenImage
from pandac.PandaModules import TextNode
class MyApp(ShowBase):
def __init__(self):
ShowBase.__init__(self)
# Load the environment model.
self.environ = self.loader.loadModel("models/environment")
# Reparent the model to render.
self.environ.reparentTo(self.render)
# Apply scale and position transforms on the model.
self.environ.setScale(0.25, 0.25, 0.25)
self.environ.setPos(-8, 42, 0)
imageObject = OnscreenImage(image = 'Book.png', pos = (0.3, 0, 0.04))
#x= Left/right
#y=
#z=up/down
text = TextNode('node name')
text.setText("Every day in every way I'm getting better and better.")
textNodePath = aspect2d.attachNewNode(text)
textNodePath.setScale(0.07)
app = MyApp()
app.run()