DirectLabel: No Padding?

I’m trying to incude some padding in a DirectLabel, and, well, it doesn’t seem to be working.

At the moment I don’t see anything that seems terribly likely to be interfering with things. Two points that might be of note are that I am immediately hiding my DirectLabel and that I frequently set its position in my update method. The final version is intended to also change its text, but, thinking that my call to “setFrameSize” might have been the reason that padding wasn’t working I commented out that functionality.

Excerpts from my code:


        #  I've tried a variety of values in the "pad" parameter, I believe;
        # the current, ridiculously high value is simply intended
        # to clearly show whether it's working at all.
        self.mouseOverLabel = DirectLabel(text="Kitten",
                                        text_fg=(0.45, 0.7, 1.0, 1),
                                        frameColor=(0, 0, 0, 0),
        self.mouseOverLabel.setBin(GUI_BIN, 0)
        self.lastMouseOver = None # Used to determine whether we should show and update the label


    if base.mouseWatcherNode.hasMouse():
        mouseX = base.mouseWatcherNode.getMouseX()
        mouseY = base.mouseWatcherNode.getMouseY()
        self.mouseOverLabel.setPos(render2d, mouseX, 0, mouseY-0.2)
        selection = self.getSelectedObject(Point3(mouseX, 0, mouseY))
        if selection is not self.lastMouseOver:
            self.lastMouseOver = selection
            if selection is None or isinstance(selection, LVecBase3) or isinstance(selection, SceneryRegion):

Any suggestions?

Further, once I reinstate the updating of the label’s text, will either the setting of the text (via 'self.mouseOverLabel[“text”] = ') or a subsequent call to ‘setFrameSize’ cause problems, and if so, what migh I do about that?

I don’t know offhand, but the DirectGui code is (mostly) written in Python, so you should be able to fairly easily walk through the implementation and figure out what it’s doing and why.

It also might be worthwhile to create a simple DirectLabel for which you don’t do these advanced things, to see where it starts to break down.


Fair enough, and thank you; I intend to do as you suggest a little later, and report back if I figure out where the problem lies.

Ah, the error seems to have been silly one on my part: in short, “padding” is applied to the frame, not to the “text back” that one colours via the “text_bg” keyword. I was setting “text_bg” to opaque black, and “frameColor” to a transparent colour; the padding was thus being applied to an invisible backdrop, while the perfectly visible text back remained unchanged. ^^;