FazBrowse GitHub Viewer | Trending |
URL:
| Home
Tools: [Download Repo ZIP]   [Original HTTPS Page]

docs(mkdocs): cover IS_DESKTOP in the platform-specific code FAQ · pythonnative/pythonnative@09f1a18 · GitHub

Commit 09f1a18

Browse files
committed
docs(mkdocs): cover IS_DESKTOP in the platform-specific code FAQ
1 parent 778a993 commit 09f1a18

1 file changed

Lines changed: 10 additions & 3 deletions

File tree

‎docs/meta/faq.md‎

Lines changed: 10 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,18 +20,25 @@ with the native UI through a versioned bridge.
2020

2121
Yes. Two patterns:
2222

23-
- **Branch on `IS_ANDROID` / `IS_IOS`** for small differences inside
24-
a shared component:
23+
- **Branch on `IS_ANDROID` / `IS_IOS` / `IS_DESKTOP`** for small
24+
differences inside a shared component:
2525

2626
```python
27-
from pythonnative.utils import IS_ANDROID, IS_IOS
27+
from pythonnative.utils import IS_ANDROID, IS_IOS, IS_DESKTOP
2828

2929
if IS_ANDROID:
3030
...
3131
elif IS_IOS:
3232
...
33+
elif IS_DESKTOP:
34+
...
3335
```
3436

37+
`pn preview` runs the app with `IS_DESKTOP` set; see the
38+
[Desktop preview guide](../guides/desktop-preview.md).
39+
For a declarative alternative, use `Platform.select({...})`; see the
40+
[Platform API](../api/platform.md).
41+
3542
- **Per-platform native modules** for larger pieces (a custom widget,
3643
a device API). Implement once per platform behind a single Python
3744
facade. See [Native modules guide](../guides/native-modules.md).

0 commit comments

Comments
 (0)

Back | FazBrowse Home | New Git URL