In this case you can use Command
tab:
ts = C.scene.tool_settings; ts.transform_pivot_point = 'CURSOR' if ts.transform_pivot_point != 'CURSOR' else 'BOUNDING_BOX_CENTER'
If you want to change text and icon of the button depending on pivot point mode you need to use L.operator()
function in Custom
tab:
ts = C.scene.tool_settings; L.operator("pme.exec", text="Cursor" if ts.transform_pivot_point == 'CURSOR' else "Box", icon='PIVOT_CURSOR' if ts.transform_pivot_point == 'CURSOR' else 'PIVOT_BOUNDBOX').cmd = "ts = C.scene.tool_settings; ts.transform_pivot_point = 'CURSOR' if ts.transform_pivot_point != 'CURSOR' else 'BOUNDING_BOX_CENTER'"
L.operator(...)
function shows basic clickable button with customizable action.
L.prop()
function shows widgets depending on the property type:
- Boolean Property - check box or toggle button
- Enum Property (your case) - drop down list or radio buttons
- Int or Float Property - number input field or slider
- String Property - text input field