Skip to content

Commit dc2db6a

Browse files
authored
docs(style): show how to select style in Python. (slint-ui#8464)
1 parent 23c1989 commit dc2db6a

File tree

2 files changed

+23
-0
lines changed

2 files changed

+23
-0
lines changed

cspell.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -76,6 +76,7 @@
7676
"standardlistview",
7777
"standardtableview",
7878
"rustup",
79+
"setdefault",
7980
"Sonoma",
8081
"SUBDIR",
8182
"Torizon",

docs/astro/src/content/docs/reference/std-widgets/style.mdx

Lines changed: 22 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -56,6 +56,28 @@ let main = new ui.Main();
5656
main.greeting = "Hello friends";
5757
```
5858
</TabItem>
59+
<TabItem label="Python">
60+
61+
You can specify the style by setting the `SLINT_STYLE` environment variable in the beginning of your Python script:
62+
63+
```python
64+
import slint
65+
import os
66+
67+
68+
os.environ["SLINT_STYLE"] = "material"
69+
# or
70+
# os.environ.setdefault("SLINT_STYLE", "material")
71+
72+
73+
class MainWindow(slint.loader.ui.app.AppWindow): ...
74+
75+
76+
main_window = MainWindow()
77+
main_window.show()
78+
main_window.run()
79+
```
80+
</TabItem>
5981
</Tabs>
6082

6183
## Using Style Properties In Your Own Components

0 commit comments

Comments
 (0)