Is there a way to "glue" input fields together in Python, like in the Properties > Render > Resolution?

enter image description here

It's not a layout box, it's not a IntVector...

I was surprised to see in how many ways a FloatVector can be displayed (e.g. numbers, RGB, RGBA, ...). Perhaps I missed an option somewhere?


This is an excerpt from properties_render.py. You can right click the property and choose Edit Source.

The properties are drawn using UILayout.column(). Specifically, it is the align=True, a property of the column, which causes the properties to appear to be 'glued' together.

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

    scene = context.scene
    rd = scene.render

    row = layout.row(align=True)
    row.menu("RENDER_MT_presets", text=bpy.types.RENDER_MT_presets.bl_label)
    row.operator("render.preset_add", text="", icon='ZOOMIN')
    row.operator("render.preset_add", text="", icon='ZOOMOUT').remove_active = True

    split = layout.split()

    col = split.column()
    sub = col.column(align=True)
    sub.prop(rd, "resolution_x", text="X")
    sub.prop(rd, "resolution_y", text="Y")
    sub.prop(rd, "resolution_percentage", text="")
| improve this answer | |
  • $\begingroup$ Nifty feature... I didn't know about it. $\endgroup$ – karamike Nov 30 '14 at 16:36

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.