Skip to content

Commit 5928734

Browse files
author
Roberto De Ioris
authored
Update Slate_API.md
1 parent a165578 commit 5928734

1 file changed

Lines changed: 28 additions & 0 deletions

File tree

docs/Slate_API.md

Lines changed: 28 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -291,7 +291,35 @@ We have alredy seen the 4-items float tuple for specifying top, left, bottom and
291291

292292
![Padding 3](https://github.com/20tab/UnrealEnginePython/raw/master/docs/screenshots/slate_Padding3.png)
293293

294+
In addition to float/float-tuples you can specify padding using the FMargin struct:
294295

296+
```python
297+
from unreal_engine.structs import Margin
298+
print(Margin.properties())
299+
```
300+
returns
301+
302+
```python
303+
['Left', 'Top', 'Right', 'Bottom']
304+
```
305+
306+
So:
307+
308+
```python
309+
from unreal_engine import SWindow, STextBlock, SVerticalBox, SBorder
310+
from unreal_engine.enums import EVerticalAlignment, EHorizontalAlignment
311+
from unreal_engine.structs import Margin
312+
313+
window = SWindow(client_size=(512, 512), title='First Slate Window')
314+
315+
vertical_box = SVerticalBox()
316+
317+
vertical_box.add_slot(SBorder()(STextBlock(text='Hello i am an STextBlock [line 0]')), padding=Margin(Left=100, Right=50), v_align=EVerticalAlignment.VAlign_Fill)
318+
319+
window.set_content(SBorder()(vertical_box))
320+
```
321+
322+
![Padding 4](https://github.com/20tab/UnrealEnginePython/raw/master/docs/screenshots/slate_Padding4.png)
295323

296324
## SHorizontalBox
297325

0 commit comments

Comments
 (0)