Adding a Scrollbar

Hi,

Has anyone ever had any problems with scroll bar in blender?

I have a line in my python script that’s meant to add a scroll bar:

Scrollbar(5, 70, 600, 80, 80, 0, 0, 10, 1, “sbar”)

And for some reason that I cannot figure out, the scroll bar never shows
up on the screen. I’m almost 100% sure that there is nothing wrong with
the function in which the line above is defined. Also, there is NO error or
warning messages displayed when I execute this script. All the other
gui components work perfectly well (in that function).

I’m using blender 2.26.

Thanks a lot.

didu

hm, i do not know (since it’s a description of an old api), but maybe the tutorials on http://www.blenderbuch.de/tutor/python3/Python3_Eng.html may help you.

greets

HI.

I’m not sure about how scrollbar works, are you sure you’re not after a Slider instead?

Here is a bit of slider test code instead:

Cheers Stephen


from Blender.Draw import *
from Blender.BGL import *

Tscroll = Create(0)
Ttext = "Slider Test"

print"_________________________________"

def gui():
    global Tscroll
    glClearColor(0.5,0.5,0.75, 0.0)
    glClear(GL_COLOR_BUFFER_BIT)
    glRasterPos2i(40, 200)
    Text (Ttext)
    Button("Exit", 1, 40, 160, 150, 25, "Exit Script")
    Tscroll = Slider('test: ',5, 40, 125, 150, 25, Tscroll.val, 0, 10, 1, "sbar")
    glColor3f (0.0, 0.0, 0.0);
    glLineWidth (1);
    glBegin (GL_LINE_LOOP);
    glVertex2f (30.0, 90.0);
    glVertex2f (210.0, 90.0);
    glVertex2f (210.0, 220.0);
    glVertex2f (30.0, 220.0);
    glEnd ();

def event(evt, val):
    print "event : ", evt, val
    if (evt == ESCKEY and not val): Exit()


def bevent(evt):
    print "bevent : ", evt

    if (evt == 5):
        print "slider value = ", Tscroll.val
    if (evt == 1): Exit()

Register(gui, event, bevent)


If it is any consolation scroll bars don’t work for me either. I am not even sure Blender has scrollbars I have never seen them in anythin python or otherwise. The closest I have seen is the doc browser witch I think just draws a box and uses mouse events to maker thier own. asdf_46