SButton¶
| Property | Type | Note |
|---|---|---|
| Aka | String | Name for the widget |
| ButtonColorAndOpacity | Number Array, Length = 4 | |
| ButtonStyle | Object | For example:"ButtonStyle": |
| ColorAndOpacity | Number Array, Length = 4 | Linear color values, for example:[0.5, 0.5, 0.5, 1] |
| Content | Object | The only child widget in this widget's content. |
| ContentPadding | Number or Number Array (Length = 2 or 4) | |
| ForegroundColor | Number Array, Length = 4 | Linear color values, for example:[0.5, 0.5, 0.5, 1] |
| HAlign | String | Enum: EHorizontalAlignment: Fill, Left, Center, Right |
| OnClick | String | The python code which will be executed. |
| Text | String | |
| TextStyle | String | For example:"TextStyle": |
| ToolTipText | String | |
| VAlign | String | Enum: EVerticalAlignment: Fill, Top, Center, Bottom |
| Visibility | Enum: EVisibility: Visible, Collapsed, Hidden, HitTestInvisible, SelfHitTestInvisible, All |
functions what can be called from ChameleonData¶
| FunctionName | Description | |
|---|---|---|
| set_text | Set the text of widget: | |
| get_text | Get the text of widget. | |
| set_color_and_opacity | Set widget's color and opacity. | |
| set_button_color_and_opacity | Set SButton's color and opacity. |
Examples¶
Example 1:
"SButton":
{
"Text": "Button Label",
"OnClick": "print('Button clicked.')"
}
Example 2:
"SButton":
{
"Text": "Colored Button",
"HAlign": "Center",
"ContentPadding": 6,
"ButtonColorAndOpacity": [0,0.5,1,1],
"ForegroundColor": [1,1,1,1],
"ToolTipText": "Tool tip text, when cursor hover.",
"OnClick": "print('Button clicked.')"
}