According to the API docs, I should be able to set a UILayout’s alignment to LEFT
, RIGHT
, CENTER
, or EXPAND
- with the latter being the default. However, changing this property seems to have no effect at all, in any situation that I’ve ever tried to use it.
It could be that this property doesn’t even do what I expect, in which case I’m very curious what its intended purpose actually is.
Right now, for example- I’m working on a panel for my studio’s artists that has a series of operators with paths as the text label, and being paths it makes sense to left-align them. In that same panel, I have a general notification for the user that is just a label, and it makes sense to center-align that, which again doesn’t seem to be possible.
actual project I’m working on is under NDA, but the gist is as follows:
def draw(self, context):
layout = self.layout
col = layout.column()
col.alignment = 'LEFT'
col.operator('my.operator', text='C:\\Centered\\Text\\Is\\Not\\Always\\Best\\')
col.operator('my.operator', text='C:\\This\\Looks\\Weird\\')
col.operator('my.operator', text='C:\\Why\\Is\\Center\\Alignment\\Forced\\')
col = layout.column()
col.alignment = 'CENTER'
col.label(text='This is a notification. It looks weird left-aligned. Alignment does nothing.')