How to control spacing/alignment of Label + Horizontal Enum Property?
I would like to achieve the layout of this panel but I’m having some issues. The example is from blender’s Bevel Operator. As far as I can tell it’s just an Enum Property without the enum_flag since only Vertices or Edges can be selected at a time:
layout = self.layout row = layout.row() row.label(text='My Prop'); row.prop(self, 'enum_prop', expand=True)
Looks pretty similar, just gotta align the label to the right.
layout = self.layout row = layout.row() split = row.split(factor=0.4) left_col = split.column(align=True) right_col = split.column(align=True) left_col.alignment = 'RIGHT' right_col.alignment = 'CENTER' left_col.label(text='My Prop'); right_col.prop(self, 'enum_prop', expand=True)
Well, I managed to align things into columns but my Enum Prop is suddenly vertical. I figured I wasn’t giving it enough room with the Split factor but that wasn’t the case. How can I achieve the result from the first image?
(Label aligned to the Right + Horizontal Enum Prop)
If anyone is wondering, here is how I created the property:
enum_items = [ ('ON', 'On', 'Description1'), ('OFF', 'Off', 'Description2')] enum_prop: EnumProperty(name='My Prop', default='OFF', items=enum_items)