A demo project of using TAPython v1.1.0 creating dynamic slate through Python code.
The latest TAPython v1.1.0, which can add Slate widget through Python.
Menu Entry in MenuConfig.json
:
"OnToolBarChameleon": {
"name": "Python Chameleon on toolbar",
"items": [
{
"name": "Button Division",
"ChameleonTools": "../Python/ButtonDivision/ButtonDivision.json"
}
]
}
chameleon_data_instance.get_all_akas
chameleon_data_instance.get_widget_path_from_aka
chameleon_data_instance.insert_slot_from_json
chameleon_data_instance.remove_widget_at
- Get the full Slate path of the button widget by its
Aka
name when the button is clicked. - Get the Slot index in the parent widget of the button through the path.
- Create a dictionary containing a
SHorizontalBox
or aSVerticalBox
, which includes 2-3 buttons, and name them according to the hierarchical relationship and the Slot index where they are located. - Convert the dictionary from step 3 into a string form of a JSON object using
json.dumps
. - Insert the widget from step 4 into the position where the clicked button is located using
insert_slot_from_json
. - Remove the original button using
remove_widget_at
."