user: What is UILayout(bpy_struct) and how is it used in Blender Python scripting?

assistant: # UILayout(bpy_struct)

base class — [`bpy_struct`](bpy.types.bpy_struct.html#bpy.types.bpy_struct "bpy.types.bpy_struct")

*class* bpy.types.UILayout(*bpy_struct*)
:   User interface layout in a panel or header

    activate_init
    :   When true, buttons defined in popups will be activated on first display (use so you can type into a field without having to click on it first)

        Type:
        :   boolean, default False

    active
    :   Type:
        :   boolean, default False

    active_default
    :   When true, an operator button defined after this will be activated when pressing return(use with popup dialogs)

        Type:
        :   boolean, default False

    alert
    :   Type:
        :   boolean, default False

    alignment
    :   Type:
        :   enum in [`'EXPAND'`, `'LEFT'`, `'CENTER'`, `'RIGHT'`], default `'EXPAND'`

    direction
    :   Type:
        :   enum in [`'HORIZONTAL'`, `'VERTICAL'`], default `'HORIZONTAL'`, (readonly)

    emboss
    :   - `NORMAL`
          Regular – Draw standard button emboss style.
        - `NONE`
          None – Draw only text and icons.
        - `PULLDOWN_MENU`
          Pull-down Menu – Draw pull-down menu style.
        - `PIE_MENU`
          Pie Menu – Draw radial menu style.
        - `NONE_OR_STATUS`
          None or Status – Draw with no emboss unless the button has a coloring status like an animation state.

        Type:
        :   enum in [`'NORMAL'`, `'NONE'`, `'PULLDOWN_MENU'`, `'PIE_MENU'`, `'NONE_OR_STATUS'`], default `'NORMAL'`

    enabled
    :   When false, this (sub)layout is grayed out

        Type:
        :   boolean, default False

    operator_context
    :   Typically set to ‘INVOKE_REGION_WIN’, except some cases in [`bpy.types.Menu`](bpy.types.Menu.html#bpy.types.Menu "bpy.types.Menu") when it’s set to ‘EXEC_REGION_WIN’.

        Type:
        :   enum in [Operator Context Items](bpy_types_enum_items/operator_context_items.html#rna-enum-operator-context-items), default `'INVOKE_DEFAULT'`

    scale_x
    :   Scale factor along the X for items in this (sub)layout

        Type:
        :   float in [0, inf], default 0.0

    scale_y
    :   Scale factor along the Y for items in this (sub)layout

        Type:
        :   float in [0, inf], default 0.0

    ui_units_x
    :   Fixed size along the X for items in this (sub)layout

        Type:
        :   float in [0, inf], default 0.0

    ui_units_y
    :   Fixed size along the Y for items in this (sub)layout

        Type:
        :   float in [0, inf], default 0.0

    use_property_decorate
    :   Type:
        :   boolean, default False

    use_property_split
    :   Type:
        :   boolean, default False

    row(*\**, *align=False*, *heading=''*, *heading_ctxt=''*, *translate=True*)
    :   Sub-layout. Items placed in this sublayout are placed next to each other in a row.

        Parameters:
        :   - **align** (*boolean**,* *(**optional**)*) – Align buttons to each other
            - **heading** (*string**,* *(**optional**,* *never None**)*) – Heading, Label to insert into the layout for this sub-layout
            - **heading_ctxt** (*string**,* *(**optional**,* *never None**)*) – Override automatic translation context of the given heading
            - **translate** (*boolean**,* *(**optional**)*) – Translate the given heading, when UI translation is enabled

        Returns:
        :   Sub-layout to put items in

        Return type:
        :   [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout")

    column(*\**, *align=False*, *heading=''*, *heading_ctxt=''*, *translate=True*)
    :   Sub-layout. Items placed in this sublayout are placed under each other in a column.

        Parameters:
        :   - **align** (*boolean**,* *(**optional**)*) – Align buttons to each other
            - **heading** (*string**,* *(**optional**,* *never None**)*) – Heading, Label to insert into the layout for this sub-layout
            - **heading_ctxt** (*string**,* *(**optional**,* *never None**)*) – Override automatic translation context of the given heading
            - **translate** (*boolean**,* *(**optional**)*) – Translate the given heading, when UI translation is enabled

        Returns:
        :   Sub-layout to put items in

        Return type:
        :   [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout")

    panel(*idname*, *\**, *default_closed=False*)
    :   Creates a collapsible panel. Whether it is open or closed is stored in the region using the given idname. This can only be used when the panel has the full width of the panel region available to it. So it can’t be used in e.g. in a box or columns.

        Parameters:
        :   - **idname** (*string**,* *(**never None**)*) – Identifier of the panel
            - **default_closed** (*boolean**,* *(**optional**)*) – Open by Default, When true, the panel will be open the first time it is shown

        Returns:
        :   `layout_header`, Sub-layout to put items in, [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout")

            `layout_body`, Sub-layout to put items in. Will be none if the panel is collapsed., [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout")

        Return type:
        :   ([`UILayout`](#bpy.types.UILayout "bpy.types.UILayout"), [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout"))

    panel_prop(*data*, *property*)
    :   Similar to `.panel(...)` but instead of storing whether it is open or closed in the region, it is stored in the provided boolean property. This should be used when multiple instances of the same panel can exist. For example one for every item in a collection property or list. This can only be used when the panel has the full width of the panel region available to it. So it can’t be used in e.g. in a box or columns.

        Parameters:
        :   - **data** ([`AnyType`](bpy.types.AnyType.html#bpy.types.AnyType "bpy.types.AnyType"), (never None)) – Data from which to take the open-state property
            - **property** (*string**,* *(**never None**)*) – Identifier of the boolean property that determines whether the panel is open or closed

        Returns:
        :   `layout_header`, Sub-layout to put items in, [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout")

            `layout_body`, Sub-layout to put items in. Will be none if the panel is collapsed., [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout")

        Return type:
        :   ([`UILayout`](#bpy.types.UILayout "bpy.types.UILayout"), [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout"))

    column_flow(*\**, *columns=0*, *align=False*)
    :   column_flow

        Parameters:
        :   - **columns** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Number of columns, 0 is automatic
            - **align** (*boolean**,* *(**optional**)*) – Align buttons to each other

        Returns:
        :   Sub-layout to put items in

        Return type:
        :   [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout")

    grid_flow(*\**, *row_major=False*, *columns=0*, *even_columns=False*, *even_rows=False*, *align=False*)
    :   grid_flow

        Parameters:
        :   - **row_major** (*boolean**,* *(**optional**)*) – Fill row by row, instead of column by column
            - **columns** (*int in* *[**-inf**,* *inf**]**,* *(**optional**)*) – Number of columns, positive are absolute fixed numbers, 0 is automatic, negative are automatic multiple numbers along major axis (e.g. -2 will only produce 2, 4, 6 etc. columns for row major layout, and 2, 4, 6 etc. rows for column major layout).
            - **even_columns** (*boolean**,* *(**optional**)*) – All columns will have the same width
            - **even_rows** (*boolean**,* *(**optional**)*) – All rows will have the same height
            - **align** (*boolean**,* *(**optional**)*) – Align buttons to each other

        Returns:
        :   Sub-layout to put items in

        Return type:
        :   [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout")

    box()
    :   Sublayout (items placed in this sublayout are placed under each other in a column and are surrounded by a box)

        Returns:
        :   Sub-layout to put items in

        Return type:
        :   [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout")

    split(*\**, *factor=0.0*, *align=False*)
    :   split

        Parameters:
        :   - **factor** (*float in* *[**0**,* *1**]**,* *(**optional**)*) – Percentage, Percentage of width to split at (leave unset for automatic calculation)
            - **align** (*boolean**,* *(**optional**)*) – Align buttons to each other

        Returns:
        :   Sub-layout to put items in

        Return type:
        :   [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout")

    menu_pie()
    :   Sublayout. Items placed in this sublayout are placed in a radial fashion around the menu center).

        Returns:
        :   Sub-layout to put items in

        Return type:
        :   [`UILayout`](#bpy.types.UILayout "bpy.types.UILayout")

    *classmethod* icon(*data*)
    :   Return the custom icon for this data, use it e.g. to get materials or texture icons.

        Parameters:
        :   **data** ([`AnyType`](bpy.types.AnyType.html#bpy.types.AnyType "bpy.types.AnyType"), (never None)) – Data from which to take the icon

        Returns:
        :   Icon identifier

        Return type:
        :   int in [0, inf]

    *classmethod* enum_item_name(*data*, *property*, *identifier*)
    :   Return the UI name for this enum item

        Parameters:
        :   - **data** ([`AnyType`](bpy.types.AnyType.html#bpy.types.AnyType "bpy.types.AnyType"), (never None)) – Data from which to take property
            - **property** (*string**,* *(**never None**)*) – Identifier of property in data
            - **identifier** (*string**,* *(**never None**)*) – Identifier of the enum item

        Returns:
        :   UI name of the enum item

        Return type:
        :   string, (never None)

    *classmethod* enum_item_description(*data*, *property*, *identifier*)
    :   Return the UI description for this enum item

        Parameters:
        :   - **data** ([`AnyType`](bpy.types.AnyType.html#bpy.types.AnyType "bpy.types.AnyType"), (never None)) – Data from which to take property
            - **property** (*string**,* *(**never None**)*) – Identifier of property in data
            - **identifier** (*string**,* *(**never None**)*) – Identifier of the enum item

        Returns:
        :   UI description of the enum item

        Return type:
        :   string, (never None)

    *classmethod* enum_item_icon(*data*, *property*, *identifier*)
    :   Return the icon for this enum item

        Parameters:
        :   - **data** ([`AnyType`](bpy.types.AnyType.html#bpy.types.AnyType "bpy.types.AnyType"), (never None)) – Data from which to take property
            - **property** (*string**,* *(**never None**)*) – Identifier of property in data
            - **identifier** (*string**,* *(**never None**)*) – Identifier of the enum item

        Returns:
        :   Icon identifier

        Return type:
        :   int in [0, inf]

    prop(*data*, *property*, *\**, *text=''*, *text_ctxt=''*, *translate=True*, *icon='NONE'*, *placeholder=''*, *expand=False*, *slider=False*, *toggle=-1*, *icon_only=False*, *event=False*, *full_event=False*, *emboss=True*, *index=-1*, *icon_value=0*, *invert_checkbox=False*)
    :   Item. Exposes an RNA item and places it into the layout.

        Parameters:
        :   - **data** ([`AnyType`](bpy.types.AnyType.html#bpy.types.AnyType "bpy.types.AnyType"), (never None)) – Data from which to take property
            - **property** (*string**,* *(**never None**)*) – Identifier of property in data
            - **text** (*string**,* *(**optional**)*) – Override automatic text of the item
            - **text_ctxt** (*string**,* *(**optional**)*) – Override automatic translation context of the given text
            - **translate** (*boolean**,* *(**optional**)*) – Translate the given text, when UI translation is enabled
            - **icon** (enum in [Icon Items](bpy_types_enum_items/icon_items.html#rna-enum-icon-items), (optional)) – Icon, Override automatic icon of the item
            - **placeholder** (*string**,* *(**optional**)*) – Hint describing the expected value when empty
            - **expand** (*boolean**,* *(**optional**)*) – Expand button to show more detail
            - **slider** (*boolean**,* *(**optional**)*) – Use slider widget for numeric values
            - **toggle** (*int in* *[**-1**,* *1**]**,* *(**optional**)*) – Use toggle widget for boolean values, or a checkbox when disabled (the default is -1 which uses toggle only when an icon is displayed)
            - **icon_only** (*boolean**,* *(**optional**)*) – Draw only icons in buttons, no text
            - **event** (*boolean**,* *(**optional**)*) – Use button to input key events
            - **full_event** (*boolean**,* *(**optional**)*) – Use button to input full events including modifiers
            - **emboss** (*boolean**,* *(**optional**)*) – Draw the button itself, not just the icon/text. When false, corresponds to the ‘NONE_OR_STATUS’ layout emboss type.
            - **index** (*int in* *[**-2**,* *inf**]**,* *(**optional**)*) – The index of this button, when set a single member of an array can be accessed, when set to -1 all array members are used
            - **icon_value** (*int in* *[**0**,* *inf**]**,* *(**optional**)*) – Icon Value, Override automatic icon of the item
            - **invert_checkbox** (*boolean**,* *(**optional**)*) – Draw checkbox value inverted

    props_enum(*data*, *property*)
    :   props_enum

        Parameters:
        :   - **data** ([`AnyType`](bpy.types.AnyType.html#bpy.types.AnyType "bpy.types.AnyType"), (never None)) – Data from which to take property
            - **property** (*string**,* *(**never None**)*) – Identifier of property in data

    prop_menu_enum(*data*, *property*, *\**, *text=''*, *text_ctxt=''*, *translate=True*, *icon='NONE'*)
    :   prop_menu_enum

        Parameters:
        :   - **data** ([`AnyType`](bpy.types.AnyType.html#bpy.types.AnyType "bpy.types.AnyType"), (never None)) – Data from which to take property
            - **property** (*string**,* *(**never None**)*) – Identifier of property in data
            - **text** (*string**,* *(**optional**)*) – Override automatic text of the item
            - **text_ctxt** (*string**,* *(**optional**)*) – Override automatic translation context of the given text
            - **translate** (*boolean**,* *(**optional**)*) – Translate the given text, when UI translation is enabled
            - **icon** (enum in [Icon Items](bpy_types_enum_items/icon_items.html#rna-enum-icon-items), (optional)) – Icon, Override automatic icon of the item

    prop_with_popover(*data*, *property*, *\**, *text=''*, *text_ctxt=''*, *translate=True*, *icon='NONE'*, *icon_only=False*, *panel*)
    :   prop_with_popover

        Parameters:
        :   - **data** ([`AnyType`](bpy.types.AnyType.html#bpy.types.AnyType "bpy.types.AnyType"), (never None)) – Data from which to take property
            - **property** (*string**,* *(**never None**)*) – Identifier of property in data
            - **text** (*string**,* *(**optional**)*) – Override automatic text of the item
            - **text_ctxt** (*string**,* *(**optional**)*) – Override automatic translation context of the given text
            - **translate** (*boolean**,* *(**optional**)*) – Translate the given text, when UI translation is enabled
            - **icon** (enum in [Icon Items](bpy_types_enum_items/icon_items.html#rna-enum-icon-items), (optional)) – Icon, Override automatic icon of the item
            - **icon_only** (*boolean**,* *(**optional**)*) – Draw only icons in tabs, no text
            - **panel** (*string**,* *(**never None**)*) – Identifier of the panel

    prop_with_menu(*data*, *property*, *\**, *text=''*, *text_ctxt=''*, *translate=True*, *icon='NONE'*, *icon_only=False*, *menu*)
    :   prop_with_menu

        Parameters:
        :   - **data** ([`AnyType`](bpy.types.AnyType.html#bpy.types.AnyType "bpy.types.AnyType"), (never None)) – Data from which to take property
            - **property** (*string**,* *(**never None**)*) – Identifier of property in data
            - **text** (*string**,* *(**optional**)*) – Override automatic text of the item
            - **text_ctxt** (*string**,* *(**optional**)*) – Override automatic translation context of the given text
            - **translate** (*boolean**,* *(**optional**)*) – Translate the given text, when UI translation is enabled
            - **icon** (enum in [Icon Items](bpy_types_enum_items/icon_items.html#rna-enum-icon-items), (optional)) – Icon, Override automatic icon of the item
            - **icon_only** (*boolean**,* *(**optional**)*) – Draw only icons in tabs, no text
            - **menu** (*string**,* *(**never None**)*) – Identifier of the menu

    prop_tabs_enum(*data*, *property*, *\**, *data_highlight=None*, *property_highlight=''*, *icon_only=False*)
    :   prop_tabs_enum

        Parameters:
        :   - **data** ([`AnyType`](bpy.types.AnyType.html#bpy.types.AnyType "bpy.types.AnyType"), (never None)) – Data from which to take property
            - **property** (*string**,* *(**never None**)*) – Identifier of property in data
            - **data_highlight** ([`AnyType`](bpy.types.AnyType.html#bpy.types.AnyType "bpy.types.AnyType"), (optional, never None)) – Data from which to take highlight property
            - **property_highlight** (*string**,* *(**optional**,* *never None**)*) – Identifier of highlight property in data
            - **icon_only** (*boolean**,* *(**optional**)*) – Draw only icons in tabs, no text

    prop_enum(*data*, *property*, *value*, *\**, *text=''*, *text_ctxt=''*, *translate=True*, *icon='NONE'*)
    :   prop_enum

        Parameters:
        :   -