Scroll the scripts window (2.49b)

I wasn’t sure if should post this here or in the interface forum but I thought here would be more appropriate. I apologize if this not the appropriate forum. I am using Blender 2.49b.

I’m writing a Python script that draws a large number of button objects, which don’t all fit in the scripts window, even when it is zoomed to full size. However, I can’t figure out a way to scroll the scripts window. I can scroll the buttons window with the middle mouse button but I can’t do this in the scripts window. The page http://www.blender.org/documentation/249PythonDoc/Draw-module.html says that the Draw module’s widgets include a scrollbar but I couldn’t find any more information about it on that page. I found some information about it through the doc member in the interactive python console but when I added a scrollbar object it had no effect. I’m not sure if the scrollbar object is what I wanted anyway. Is there a way to scroll the scripts window, or get python to add a way to scroll it?

You can take a look at my scrollable list box, if you like.

Hi, I have been looking at this code for creating a Window to be scrollable. But I am not familiar with Blender BGL. And I its hard to follow it because I am not that good with Blender Python.

Is there another alternative to scroll the Entire Window with the usual Blender.Draw GUI widgets… But I think I can try to code it

I managed to solved it, I just messed around then I thought that I can mimic scrolling by just moving all the GUI Widgets on my windowFrame using MouseScroll button events.


#!BPY

import bpy
import Blender
from Blender import Draw,Window


toggle = 0    
scrollby = 0

textInput = Draw.Create("d")

############################################################################
# Blender Recursively calls this functions in order to Redraw the GUI
# Local Values in this functions will be re-initialized for each Function Call
# Store variables in the Global Scope in order to keep values. eg Textbox values
############################################################################
#FunctionNames are not reserved! U can define any name, then Register in Blender.Draw
def drawMe():            
    global strInput,textInput, toggle
    global scrollby
            
    
    # Toggle(name,event,x,y,width,height,default,"popupTooltip")
    textInput = Draw.Create(textInput.val)
    
    Draw.Toggle("Move TextBox",2,200,150 +scrollby, 100,20,toggle,"All Textboxes & values")
    print toggle
    if toggle == 1:
        textInput= Draw.String("Str: ",1,500,200 +scrollby,100,20,textInput.val,20,"its tooltip")
    else:
        textInput= Draw.String("Str: ",1,200,200 +scrollby,100,20,textInput.val,20,"its tooltip")
            
    
    #Create TextBox
    
    #WindowGrid position for placed widgets relative to Window size
    xPos,yPos = (Window.GetAreaSize()[0], Window.GetAreaSize()[1])
    
    Draw.PushButton("Exit",3,xPos-100,5, 100,20,"All Textboxes & values")
    
    #****Scrollbar
    resolution = Blender.Window.GetScreenSize()
    screenArea = Blender.Window.GetAreaSize()
    mouseCoord = Blender.Window.GetMouseCoords()

    
    #Check if MouseCursor is on top of Scrollbar,
    #then use ScreenCoordinates to scroll the Window
    inArea = resolution[0]-Blender.Window.GetAreaSize()[0]
    if abs(mouseCoord[0] - inArea) < 20:
        print (abs(mouseCoord[0] - inArea)), "	Mouse=",\
        Blender.Window.GetMouseCoords() 
        scrollby = mouseCoord[1]
            
    myvar = Draw.Scrollbar(0, 0,0, 20, yPos, scrollby,1,500, 0,"Window Scrolling")
    
    #print Blender.Window.GetAreaSize() , "	", Blender.Window.GetMouseCoords()
    
        
############################################################################
#Handles system events. Eg. from a keyboard or Mouse
############################################################################    
def sysEvent(evt,val):
    global scrollby
    if evt == Blender.Draw.ESCKEY:
        Blender.Draw.Exit()
        return 

    #Increament "scrollby" to Scroll all Widgets on the Window
    if evt == Draw.WHEELDOWNMOUSE :
        scrollby += 50
    #Decreament scrollby ,, ,, ,,
    if evt== Draw.WHEELUPMOUSE:
        scrollby -= 50

        
    #Refresh the GUI when you move the Mouse
    if evt == Draw.MOUSEX:
        Draw.Redraw(1)

    Draw.Redraw(1)

############################################################################
#EventHandler for all GUI widget evetnts
############################################################################
def guiEvents(eventPassed):  
    global toggle
    
    if eventPassed == 1:
        print None

    if eventPassed == 2:
        #Draw.UIBlock(drawMe,toggle)
        toggle = 1 - toggle
        Draw.Redraw(1)
                    
    if eventPassed == 3:
        Draw.Exit()
        
    

Blender.Draw.Register(drawMe,sysEvent,guiEvents)



I tried writing brief comments but feel free to ask anything. :RocknRoll: