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.
✨ Add an illustration for Textualize/textual#3517
- Loading branch information
Showing
1 changed file
with
38 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,38 @@ | ||
"""https://github.com/Textualize/textual/issues/3517""" | ||
|
||
from textual.app import App, ComposeResult | ||
from textual.containers import Grid, Container | ||
|
||
class BusyBox(Container, can_focus=True): | ||
|
||
DEFAULT_CSS = """ | ||
BusyBox { | ||
border: panel red; | ||
} | ||
BusyBox:focus { | ||
border: panel green; | ||
} | ||
""" | ||
|
||
def __init__(self, number: int) -> None: | ||
super().__init__() | ||
self.border_title = f"Busy box {number}" | ||
self.loading = bool(number % 3) | ||
|
||
class LoadingApp(App[None]): | ||
|
||
CSS = """ | ||
Grid { | ||
grid-size: 4; | ||
} | ||
""" | ||
|
||
def compose(self) -> ComposeResult: | ||
with Grid(): | ||
for n in range(16): | ||
yield BusyBox(n) | ||
|
||
if __name__ == "__main__": | ||
LoadingApp().run() | ||
|
||
### loading_test.py ends here |