PandaEPL error text.py


#1

Hello,

I am trying to run a program that needs Panda3D: PandaEPL.

I am having this error, that I can not fix:
File “/Library/Python/2.7/site-packages/pandaepl/Text.py”, line 160, in __updateFirstLineHeight
self.firstLineHeight = bounds[1][2]-bounds[0][2]
TypeError: ‘NoneType’ object has no attribute ‘getitem

The code is:
def __updateFirstLineHeight(self):
“”"
Updates the height of the first line using the
currently set text.
“”"
pos = self.getPos()
text = self.getText()
firstLine = text.split("\n")[0]
self.retrNodePath().node().setText(firstLine)
bounds = self.retrNodePath().getTightBounds()
self.firstLineHeight = bounds[1][2]-bounds[0][2]
self.retrNodePath().node().setText(text)

    # Reset text position to use new line height.
    self.setPos(pos)

Can anybody help me please?

Many thanks


#2

getTightBounds() now returns None if the model has no vertices at all. You need to check for that explicitly:

bounds = self.retrNodePath().getTightBounds()
if bounds:
    self.firstLineHeight = bounds[1][2]-bounds[0][2]
else:
    self.firstLineHeight = 0