I am trying to create a simple menu with three fields below each other. The description on the left, the clickable part on the right. However, blender makes my layout explode!

This is what I think it should look like (done in MS paint): This is what I think it should look like

This is what it actually ends up looking like (for some reason the fields are "staggered"): This is what it looks like

This is what I have tried:

import bpy

class MyMenu(bpy.types.Menu):
    bl_idname = "OBJECT_MT_my_menu"
    bl_label = "my_menu"

    def draw(self, context):
        layout = self.layout
        col = layout.column()
        col.prop(context.object, 'name', text='First field - object name')
        col.prop(context.object, 'parent', text='Second field - object parent')
        col.prop(context.object, 'location', text='Third field - object location')

class OpenMyMenu(bpy.types.Operator):
    bl_idname = "view3d.open_my_menu"
    bl_label = "Open My Menu"
    bl_options = {'REGISTER'}

    def execute(self, context):
        return {'FINISHED'}


Why does blender explode my layout like this and how can it be fixed? I have tried messing around with rows and columns and alignment, but it always ends up looking like this.

  • $\begingroup$ Menu layouts are mostly for operators, and in some cases checkboxes. Consider using a popup $\endgroup$ – batFINGER Sep 18 '18 at 11:46

Your Answer

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

Browse other questions tagged or ask your own question.