Skip to content

Commit cedc582

Browse files
author
Roberto De Ioris
committed
2 parents b335fa2 + 79fd7c5 commit cedc582

File tree

1 file changed

+52
-1
lines changed

1 file changed

+52
-1
lines changed

docs/Slate_API.md

Lines changed: 52 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -493,6 +493,57 @@ window = SWindow(client_size=(512, 256), title='Slate Window')(
493493
)
494494
```
495495

496-
## SEditableTextBox
496+
![SButton](https://github.com/20tab/UnrealEnginePython/raw/master/docs/screenshots/slate_SButton.png)
497+
498+
Note that technically SButton's are containers so you can assign to them another widget:
499+
500+
```python
501+
SButton(on_clicked=lambda: window.request_destroy())(STextBlock(text='Hello'))
502+
```
503+
504+
More infos here: https://api.unrealengine.com/INT/API/Runtime/Slate/Widgets/Input/SButton/index.html
497505

498506
## SImage
507+
508+
This widget draw graphics resources (images, solid blocks).
509+
510+
```python
511+
from unreal_engine import SWindow, SImage, SVerticalBox, FLinearColor, SBorder
512+
from unreal_engine.structs import SlateBrush, SlateColor, Vector2D
513+
from unreal_engine.classes import Texture2D
514+
import unreal_engine as ue
515+
import os
516+
517+
plugin = unreal_engine.find_plugin('UnrealEnginePython')
518+
plugin_base_dir = plugin.get_base_dir()
519+
520+
image_file = os.path.join(plugin_base_dir, 'Resources/Icon128.png')
521+
522+
texture = ue.load_object(Texture2D, '/Game/Mannequin/Character/Textures/UE4_LOGO_CARD')
523+
524+
525+
window = SWindow(client_size=(128, 512), title='Slate Window', sizing_rule=0)(
526+
SVerticalBox()
527+
(
528+
SImage(image=SlateBrush(ResourceName=image_file, bIsDynamicallyLoaded=True)),
529+
)
530+
(
531+
SImage(image=SlateBrush(ResourceObject=texture))
532+
)
533+
(
534+
SImage(image=SlateBrush(TintColor=SlateColor(SpecifiedColor=FLinearColor(1, 0, 0))))
535+
)
536+
(
537+
SImage(image=SlateBrush(ResourceName=image_file, bIsDynamicallyLoaded=True, TintColor=SlateColor(SpecifiedColor=FLinearColor(0, 1, 0))))
538+
)
539+
(
540+
SBorder()(SImage(image=SlateBrush(ResourceObject=texture, ImageSize=Vector2D(X=64, Y=64)))), auto_height=True
541+
)
542+
)
543+
```
544+
545+
![SImage](https://github.com/20tab/UnrealEnginePython/raw/master/docs/screenshots/slate_SImage.png)
546+
547+
## SEditableTextBox
548+
549+

0 commit comments

Comments
 (0)