This repository has been archived by the owner on Jun 21, 2024. It is now read-only.
-
Notifications
You must be signed in to change notification settings - Fork 2
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
✨ Examples for Textualize/textual#3781
- Loading branch information
Showing
4 changed files
with
53 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,11 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.widgets import Static | ||
|
||
class NoChildren1(App[None]): | ||
|
||
def compose(self) -> ComposeResult: | ||
with Static(): | ||
yield Static("Hello") | ||
|
||
if __name__ == "__main__": | ||
NoChildren1().run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.widgets import Static | ||
|
||
class DodgyStatic(Static): | ||
|
||
def compose(self) -> ComposeResult: | ||
yield Static("Hello") | ||
|
||
class NoChildren2(App[None]): | ||
|
||
def compose(self) -> ComposeResult: | ||
yield DodgyStatic() | ||
|
||
if __name__ == "__main__": | ||
NoChildren2().run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,13 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.widgets import Static | ||
|
||
class NoChildren1(App[None]): | ||
|
||
def compose(self) -> ComposeResult: | ||
yield Static() | ||
|
||
def on_mount(self) -> None: | ||
self.query_one(Static).mount(Static("Hello")) | ||
|
||
if __name__ == "__main__": | ||
NoChildren1().run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.widget import Widget | ||
from textual.widgets import Static | ||
|
||
class NotACounter(Widget): | ||
ALLOW_CHILDREN = False | ||
|
||
class NoChildren4(App[None]): | ||
|
||
def compose(self) -> ComposeResult: | ||
yield NotACounter(Static("Hello")) | ||
|
||
if __name__ == "__main__": | ||
NoChildren4().run() |