Getting error "AttributeError: 'dict' object has no attribute 'gotName'" Need help


#1

Hey there guys, Derek here. I’ve been working on a small project recently, somewhat of a landwalker. I’ve been fiddling with my nametag code for awhile now, but seem to keep getting the same error - AttributeError: ‘dict’ object has no attribute ‘gotName’ - Anyone know why this is?

Here’s the code:


class player(Actor.Actor, DirectObject):
    def __init__(self, parent, player_data, pos):
        self.label = DirectLabel(scale=.5, text=self.name.capitalize())
        self.label.setPos(self, 0, 0, 2)        
        self.label.wrtReparentTo(self)      
        self.label['text_bg'] = (.9,.9,.8,.7)

Thanks,
-Derek


#2

You forgot to upcall into the parent class’ __init__ function:

    def __init__(self, parent, player_data, pos):
        Actor.Actor.__init__(self)