6
$\begingroup$

So that in a tool shelve you can either via a line or a and empty space indicate groups of buttons without having to use the class command to define sections in a panel?

The only two ways I see currently is either via a label enter image description here

Or via the class

enter image description here

$\endgroup$
7
$\begingroup$

The definitive place for UI examples is the UI cookbook. The layout templating syntax hasn't changed much since the early 2.5 releases.

There is layout.separator() for a subtle space between consecutive items. The vertical space is added automatically if multiple items appear on one row.

class LayoutDemoPanel(bpy.types.Panel):
    """Creates a Panel in the scene context of the properties editor"""
    bl_label = "Layout Demo"
    bl_idname = "SCENE_PT_layout"
    bl_space_type = 'PROPERTIES'
    bl_region_type = 'WINDOW'
    bl_context = "scene"

    def draw(self, context):
        layout = self.layout

        scene = context.scene

        row = layout.row()
        row.prop(scene, "frame_start")
        row.prop(scene, "frame_end")
        row = layout.row()
        row.prop(scene, "frame_start")
        row.prop(scene, "frame_end")        
        layout.row().separator()
        row = layout.row()        
        row.prop(scene, "frame_start")
        row.prop(scene, "frame_end")
        row = layout.row()
        row.prop(scene, "frame_start")
        row.prop(scene, "frame_end")                
        layout.row().separator()
        row = layout.row()        
        row.prop(scene, "frame_start")
        row.prop(scene, "frame_end")

enter image description here

Or for a more defined delineation, one might use layout.box()

def draw(self, context):
    layout = self.layout

    scene = context.scene

    box = layout.box()
    row = box.row()
    row.prop(scene, "frame_start")
    row.prop(scene, "frame_end")
    row = box.row()
    row.prop(scene, "frame_start")
    row.prop(scene, "frame_end")        

    box = layout.box()
    row = box.row()
    row.label('some label')
    row = box.row()        
    row.prop(scene, "frame_start")
    row.prop(scene, "frame_end")
    row = box.row()
    row.prop(scene, "frame_start")
    row.prop(scene, "frame_end")                

    box = layout.box()
    row = box.row()
    row.prop(scene, "frame_start")
    row.prop(scene, "frame_end")

enter image description here

A vertical split using box and column. You might struggle with this, this is normal.

def draw(self, context):
    layout = self.layout

    scene = context.scene

    col = layout.row()
    split = col.split(percentage=0.5)
    box = split.column().box()

    row = box.row()
    row.label('some label 1')
    row = box.row()        
    row.prop(scene, "frame_start")
    row.prop(scene, "frame_end")
    row = box.row()
    row.prop(scene, "frame_start")
    row.prop(scene, "frame_end")        

    box = split.column().box()
    row = box.row()
    row.label('some label 2')
    row = box.row()        
    row.prop(scene, "frame_start")
    row.prop(scene, "frame_end")
    row = box.row()
    row.prop(scene, "frame_start")
    row.prop(scene, "frame_end")           

enter image description here

$\endgroup$
1
  • $\begingroup$ Perfect - the box command perfectly can do this! $\endgroup$ Jan 1 '16 at 20:20

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.