Skip to content

Commit 2ca6776

Browse files
author
Roberto De Ioris
authored
Update Slate_API.md
1 parent 10458da commit 2ca6776

File tree

1 file changed

+25
-0
lines changed

1 file changed

+25
-0
lines changed

docs/Slate_API.md

Lines changed: 25 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -468,6 +468,31 @@ More infos here: https://api.unrealengine.com/INT/API/Runtime/Slate/Widgets/Layo
468468

469469
## SButton
470470

471+
It's time for user interaction. The SButton widget raises an event whenevr the user clicks on it:
472+
473+
```python
474+
from unreal_engine import SWindow, SVerticalBox, SButton
475+
from unreal_engine.enums import EHorizontalAlignment
476+
import unreal_engine as ue
477+
import time
478+
479+
window = SWindow(client_size=(512, 256), title='Slate Window')(
480+
SVerticalBox()
481+
(
482+
SButton(text='Button 001', on_clicked=lambda: ue.log('Hello i am Button001'))
483+
)
484+
(
485+
SButton(text='Button 002', h_align=EHorizontalAlignment.HAlign_Center, on_clicked=lambda: (ue.message_dialog_open(ue.APP_MSG_TYPE_OK, 'Hello i am Button002'), window.bring_to_front()))
486+
)
487+
(
488+
SButton(text='Update title with current time', on_clicked=lambda: window.set_title(str(time.time())))
489+
)
490+
(
491+
SButton(text='Close Window', on_clicked=lambda: window.request_destroy())
492+
)
493+
)
494+
```
495+
471496
## SEditableTextBox
472497

473498
## SImage

0 commit comments

Comments
 (0)