a simple problem

i am new to panda3d programming i have an small problem which i cant solve
the
error message:
The debugged program raised the exception unhandled NameError
“name ‘TextNode’ is not defined”

it says text node is not defined but in
panda3d.org/manual/index.php/Text_Node
they dont give me include i know its my mistake and that i want to solve
here is the code written in python:

from direct.showbase.ShowBase import ShowBase
class myapp(ShowBase):
    def __init__(self):
        ShowBase.__init__(self)
    text = TextNode("node name")
    text.setText("hello world panda3d rocks and it is cool")
app = myapp()
app.run()

Hi,

from panda3d.core import *

Usually solves these kind of problems.

The reference is also a good place to start looking:
panda3d.org/reference/1.8.0/ … xtNode.php

Welcome to the forums! :slight_smile:

For the record, the code won’t show up the text because you haven’t put your TextNode into the scene graph. So do something like:

self.nodePath = render2d.attachNewNode(text)

Now your text will be in the “render2d” scene graph, on top of the 3D scene. You can then use the nodePath handle to position and scale it around.

thanks by doing this

from panda3d.core import *

the problem solves
but

self.nodePath = render2d.attachNewNode(text)

did not work
it says render2d is not defined
what i have to replace with render2d

In your case, you inherit from ShowBase, so it’s self.render2d. But your code is out of the init.

i tired it
it syas didnt work
self is not defined
i event tried ShowBase
none has worked

That’s because your code is outside of the constructor.

I advise learning Python before trying to do anything with Panda3D.

thanks man