Skip to content

1.5 DirectCollapsibleFrame

Fireclaw edited this page Nov 9, 2021 · 1 revision

A frame that can be collapsed and extended on the click of a button located on top of it

Example

from DirectGuiExtension.DirectCollapsibleFrame import DirectCollapsibleFrame

collapsibleFrame = DirectCollapsibleFrame(
    frameColor=(1,1,1,1),
    frameSize=(-0.5,0.5,-0.5,0.5))

# add a test button to the frame
testButton = DirectButton(
    text="Test",
    scale=0.1,
    parent=collapsibleFrame,
    command=print,
    extraArgs=["Test button"])

# handle events when the frame gets collapsed or extended
do = DirectObject()
do.accept(collapsibleFrame.getExtendedEvent(), print, ["test extend"])
do.accept(collapsibleFrame.getCollapsedEvent(), print, ["test collapse"])

Options

headerheight: Float
Height of the header button

collapsed: Boolean
State of the frame, either collapsed (True) or extended (False)

collapseText: String
Text shown on the header button if the frame is extended

extendText: String
Text shown on the header button if the frame is collapsed

Clone this wiki locally