DirectScrolledList is adding some kind of button in bg

So I’m creating a screen where the player can select one of 3 characters they have to play the game with. I’m using a DirectScrolledList to generate the list of characters available, but for some reason it’s adding an item to the background and I can’t figure out why:

If you look to the left of the ‘Select Character’ text, you can see what looks like a DirectButton behind the DirectScrolledList object. But if I comment out the DirectScrolledList from the code, the button disappears so it’s got to be something with that object.

Here’s the current code:

    def CharacterLoadingScreen(self):
        self.CharacterLoadingScreenFrame = DirectFrame(frameColor=(0, 0, 0, 0),
                                                    frameSize=(0, 0, 0, 0),
                                                    pos=(0, 0, 0))
        
        QuitButton = DirectButton(text = ("Exit Game", "Exit Game", "Exit Game", "Exit Game"), 
                                  pos = (-0.8, 0, -0.8), 
                                  scale = 0.075, 
                                  pad = (2, 1),
                                  command=self.QuitGameButtonClicked)
        QuitButton.reparentTo(self.CharacterLoadingScreenFrame)

        
        KillFrameButton = DirectButton(text = ("Kill", "Kill", "Kill", "Kill"), 
                                  pos = (0.8, 0, -0.8), 
                                  scale = 0.075, 
                                  pad = (2, 1),
                                  command=self.KillFrame)
        KillFrameButton.reparentTo(self.CharacterLoadingScreenFrame)

        
        CharacterSelectionList = DirectScrolledList(
            forceHeight = 0.15,
            frameSize = (0, 10, -0.5, 0.5),
            frameColor = (0, 0, 0, 0.0),
            numItemsVisible = 4,
            pos = (0, 0, 0.8))        
        b = DirectLabel(text = "Select Character:", scale = 0.1, frameSize = (-0.5, 12.5, -0.5, 1), pad = (1, 1), text_align=TextNode.ALeft)
        CharacterSelectionList.addItem(b)
        for c in ["Character Slot 1", "Character Slot 2", "Character Slot 3"]:
            b = DirectButton(text = c, scale = 0.1, frameSize = (-0.5, 12.5, -0.5, 1), pad = (1, 1), text_align=TextNode.ALeft)
            CharacterSelectionList.addItem(b)
        CharacterSelectionList.reparentTo(self.CharacterLoadingScreenFrame)

Can somebody tell me how to get rid of that annoying little button-like object? I know it’s probably some obvious setting for the DirectScrolledList object, but I can’t figure it out.

That’s the “relief” behind the frame. All DirectGui objects create a relief of some kind by default, which is a bit of geometry to represent the extents of the gui object’s frame.

To suppress it, pass relief = None to the constructor.

David

No luck, didn’t work.

        CharacterSelectionList = DirectScrolledList(
            forceHeight = 0.15,
            frameSize = (0, 10, -0.5, 0.5),
            frameColor = (0, 0, 0, 0.0),
            numItemsVisible = 4,
            pos = (-1, 0, 0.8),
            relief = None)        
        b = DirectLabel(text = "Select Character:", 
                        scale = 0.1, 
                        frameSize = (-0.25, 6.25, -0.5, 0.75), 
                        pad = (1, 1), 
                        text_scale = 0.5,
                        text_align=TextNode.ALeft)
        CharacterSelectionList.addItem(b)
        for c in ["Character Slot 1", "123456789012 123456789012", "Create New Character"]:
            b = DirectButton(text = c, 
                             scale = 0.1, 
                             frameSize = (-0.25, 6.25, -0.5, 0.75), 
                             pad = (1, 1), 
                             text_scale = 0.5,
                             text_align=TextNode.ALeft)
            CharacterSelectionList.addItem(b)
        CharacterSelectionList.reparentTo(self.CharacterLoadingScreenFrame)

I tried passing relief=SUNKEN and relief=“SUNKEN” to it just to see if it makes a difference and it throws a KeyError. It seems to accept relief=None, but it’s not doing anything with it.

Maybe it’s coming from your DirectLabel. Give that one a relief = None too.

David

This is what I get by adding relief = None to both the DirectScrolledList and DirectLabel:

Here’s the current code for this screen:

    def CharacterLoadingScreen(self):
        
        myCharacters = {100 : "My First Toon"}
        # ignore this, it's a work in progress
        
        self.CharacterLoadingScreenFrame = DirectFrame(frameColor=(0, 0, 0, 0),
                                                    frameSize=(0, 0, 0, 0),
                                                    pos=(0, 0, 0))
        
        QuitButton = DirectButton(text = ("Exit Game", "Exit Game", "Exit Game", "Exit Game"), 
                                  pos = (-0.8, 0, -0.8), 
                                  scale = 0.075, 
                                  pad = (2, 1),
                                  command=self.QuitGameButtonClicked)
        QuitButton.reparentTo(self.CharacterLoadingScreenFrame)

        
        KillFrameButton = DirectButton(text = ("Kill", "Kill", "Kill", "Kill"), 
                                  pos = (0.8, 0, -0.8), 
                                  scale = 0.075, 
                                  pad = (2, 1),
                                  command=self.KillFrame)
        KillFrameButton.reparentTo(self.CharacterLoadingScreenFrame)

        CharacterList = {}
        for myToonID, myToonName in myCharacters.iteritems():
            print myToonName
        # ignore this, it's a work in progress
            

        
        CharacterSelectionList = DirectScrolledList(
            forceHeight = 0.15,
            frameSize = (0, 10, -0.5, 0.5),
            frameColor = (0, 0, 0, 0.0),
            numItemsVisible = 4,
            pos = (-1, 0, 0.8),
            relief = None)        
        b = DirectLabel(text = "Select Character:", 
                        scale = 0.1, 
                        frameSize = (-0.25, 6.25, -0.5, 0.75), 
                        pad = (1, 1), 
                        text_scale = 0.5,
                        text_align=TextNode.ALeft,
                        relief = None)
        CharacterSelectionList.addItem(b)
        for c in ["Character Slot 1", "123456789012 123456789012", "Create New Character"]:
            b = DirectButton(text = c, 
                             scale = 0.1, 
                             frameSize = (-0.25, 6.25, -0.5, 0.75), 
                             pad = (1, 1), 
                             text_scale = 0.5,
                             text_align=TextNode.ALeft)
            CharacterSelectionList.addItem(b)
        CharacterSelectionList.reparentTo(self.CharacterLoadingScreenFrame)
   

Any other ideas David?

Well, that appears to be the relief for a frame that is of size (0, 0, 0, 0), because all of the bevel points meet in the middle.

I do see such a (0, 0, 0, 0) frame in your code: the CharacterLoadingScreenFrame. And that one does not yet have relief = None.

David

Didn’t work David. But I’ve got good news and bad news.

The good news is I figured out what it is - it’s the stupid decButton and incButton objects.

The bad news is I don’t see a command to remove them from the list.

        CharacterSelectionList = DirectScrolledList(
            decButton_text = "Dec",
            decButton_text_scale = 0.04,
            incButton_text = "Dec",
            incButton_text_scale = 0.04,
            forceHeight = 0.15,
            frameSize = (0, 10, -0.5, 0.5),
            frameColor = (0, 0, 0, 1),
            numItemsVisible = 4,
            pos = (-1, 0, 0.8),
            relief = None)

I tried doing:

del CharacterSelectionList.decButton

But python didn’t think that was too funny.

If there’s no way to delete those buttons then I’m stuck changing the position of them so they are always way off the screen, which seems silly. So do you know how to remove the 2 buttons?

EDIT: I just discovered that I can set the frameSize of the buttons to 0, which basically removes them from the screen. However I’m not really happy with that solution and would like to know how to actually delete them.

Current screenshot:

        CharacterSelectionList = DirectScrolledList(
            decButton_text = "Dec",
            decButton_text_scale = 0.04,
            decButton_frameSize = (0, 0, 0, 0),
            incButton_text = "Dec",
            incButton_text_scale = 0.04,
            incButton_frameSize = (0, 0, 0, 0),
            forceHeight = 0.15,
            frameSize = (0, 10, -0.5, 0.5),
            frameColor = (0, 0, 0, 1),
            numItemsVisible = 4,
            pos = (-1, 0, 0.8),
            relief = None)

The incButton and decButton are the whole reason that DirectScrolledList exists. Without these buttons, it’s just a DirectFrame. If you don’t want the scrolling behavior that these buttons give you, then why not just use a regular DirectFrame?

David

ROFL!

For some reason that eludes me I wanted the scrolled list, but now I can’t recall why. Oh well, ignore my stupidity. Nothing to see here :wink: