[solved] Scrollbar position in a DirectScrolledFrame

I’d like to manually configure the height of the vertical scrollbar in a DirectScrolledFrame. But I haven’t been able to figure out how to do so.

This is what I tried:

from direct.gui.DirectGui import DirectScrolledFrame
import direct.directbase.DirectStart

myframe = DirectScrolledFrame(
    canvasSize=(-.5,.5,-2,2),
    frameSize=(-.54,.54,-.5,.5),
    horizontalScroll_frameSize=(0, 0, 0, 0), # Hide it.
    verticalScroll_frameSize=(-0.04, 0.04, -0.1, 0.3) # This has no effect.
)
myframe.setPos(0, 0, 0)

run()

Try verticalScroll_pos and/or verticalScroll_scale. You will probably also need to set manageScrollBars = 0 so the frame won’t try to undo your efforts.

David

I tried this:

from direct.gui.DirectGui import DirectButton, DirectScrolledFrame
import direct.directbase.DirectStart

myframe = DirectScrolledFrame(
    canvasSize=(-.5,.5,-1,1),
    frameSize=(-.54,.54,-.7,.7),
    horizontalScroll_frameSize=(0, 0, 0, 0), # Hide it.
    verticalScroll_frameSize=(-0.14, -0.06, -0.1, 0.3), # This has no effect.
    verticalScroll_scale=0.6, # This has no effect.
    manageScrollBars = False # This has no effect.
)
myframe.verticalScroll.setPos(-0.5,0,0.5) # This has no effect.

DirectButton(
    parent=myframe.getCanvas()
)

run()

The scrollbar didn’t move.

Ah, my apologies. It turns out you also have to set autoHideScrollBars = False, or manageScrollBars is implied anyway.

David

That did it. Thanks!