Moving Onscreen Text [solved]


So as part of a system for the user to type commands into my program, every time they enter text and hit enter, I create a new onscreen text instance, add it to a list, and move all of the instances up to make room for the new one.

However, when I attempt to use .setPos(), I get the following error:

File "C:\Panda3D-1.5.4\direct\src\gui\", line 293, in setPos
  File "C:\Panda3D-1.5.4\direct\src\gui\", line 324, in updateTransformMat
    assert(isinstance(self.textNode, TextNode))

My code is as follows:
(The formatting keeps getting screwed up when I enter it hereā€¦)

if self.enteredText != '':
                for text in self.displayedText:
                    x = text.getPos()[0]
                    y = text.getPos()[1]
                    y += .05

with the function addOText:

def addOText(self,msg):
        return OnscreenText(text=msg, pos=(-1.1, .25), align=TextNode.ALeft, scale = .05)

Any ideas?

You need to pass mayChange = True to the OnscreenText constructor.


Ah, missed that in the manual. Sorry about that, and thanks.