Moving Onscreen Text [solved]

Hello,

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\OnscreenText.py", line 293, in setPos
    self.updateTransformMat()
  File "C:\Panda3D-1.5.4\direct\src\gui\OnscreenText.py", line 324, in updateTransformMat
    assert(isinstance(self.textNode, TextNode))
AssertionError

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

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

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.

David

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