Skip to content
This repository has been archived by the owner on Jun 21, 2024. It is now read-only.

Commit

Permalink
✨ Examples for Textualize/textual#3781
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Nov 29, 2023
1 parent 8fe568d commit af828ed
Show file tree
Hide file tree
Showing 4 changed files with 53 additions and 0 deletions.
11 changes: 11 additions & 0 deletions no_children1.py
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()
15 changes: 15 additions & 0 deletions no_children2.py
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()
13 changes: 13 additions & 0 deletions no_children3.py
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()
14 changes: 14 additions & 0 deletions no_children4.py
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()

0 comments on commit af828ed

Please sign in to comment.