Hi,
is there a way to nest boxes ?
thanks for your help
Phil
You won’t be able to do this natively I think. You might want to explore using Panels and Subpanels though.
it’s mostly possible, using rows and separators. not perfect but it gets you about 90% the way there
code:
import bpy
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
box = layout.box()
scene = context.scene
# Create a simple row.
box.label(text=" Simple Row:")
row = box.row()
row.prop(scene, "frame_start")
row.prop(scene, "frame_end")
# Create an row where the buttons are aligned to each other.
box.label(text=" Aligned Row:")
row = box.row(align=True)
row.prop(scene, "frame_start")
row.prop(scene, "frame_end")
row = layout.row()
row.separator_spacer()
box = row.box()
# Create two columns, by using a split layout.
split = box.split()
# First column
col = split.column()
col.label(text="Column One:")
col.prop(scene, "frame_end")
col.prop(scene, "frame_start")
# Second column, aligned
col = split.column(align=True)
col.label(text="Column Two:")
col.prop(scene, "frame_start")
col.prop(scene, "frame_end")
row = layout.row()
row.separator_spacer()
box = row.box()
# Big render button
box.label(text="Big Button:")
row = box.row()
row.scale_y = 3.0
row.operator("render.render")
# Different sizes in a row
box.label(text="Different button sizes:")
row = box.row(align=True)
row.operator("render.render")
sub = row.row()
sub.scale_x = 2.0
sub.operator("render.render")
row.operator("render.render")
def register():
bpy.utils.register_class(LayoutDemoPanel)
def unregister():
bpy.utils.unregister_class(LayoutDemoPanel)
if __name__ == "__main__":
register()
maybe my fault, I did a quick drawing with paint
I am not only looking for a separator, I really need a box inside a box
yep, totally possible… as a side note it probably would have been just as fast to try it out and see if it works without having to wait for replies on a forum
import bpy
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
box1 = layout.box()
scene = context.scene
# Create a simple row.
box1.label(text=" Simple Row:")
row = box1.row()
row.prop(scene, "frame_start")
row.prop(scene, "frame_end")
# Create an row where the buttons are aligned to each other.
box1.label(text=" Aligned Row:")
row = box1.row(align=True)
row.prop(scene, "frame_start")
row.prop(scene, "frame_end")
box2 = box1.box()
# Create two columns, by using a split layout.
split = box2.split()
# First column
col = split.column()
col.label(text="Column One:")
col.prop(scene, "frame_end")
col.prop(scene, "frame_start")
# Second column, aligned
col = split.column(align=True)
col.label(text="Column Two:")
col.prop(scene, "frame_start")
col.prop(scene, "frame_end")
box3 = box1.box()
# Big render button
box3.label(text="Big Button:")
row = box3.row()
row.scale_y = 3.0
row.operator("render.render")
# Different sizes in a row
box3.label(text="Different button sizes:")
row = box3.row(align=True)
row.operator("render.render")
sub = row.row()
sub.scale_x = 2.0
sub.operator("render.render")
row.operator("render.render")
def register():
bpy.utils.register_class(LayoutDemoPanel)
def unregister():
bpy.utils.unregister_class(LayoutDemoPanel)
if __name__ == "__main__":
register()
I tried it out (box.layout) did not work, hence my post
thanks for your answer