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

Commit

Permalink
✨ Example for Textualize/textual#3733
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Nov 22, 2023
1 parent ead59d5 commit 43a4b62
Showing 1 changed file with 31 additions and 0 deletions.
31 changes: 31 additions & 0 deletions loading_overlay_redux.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
"""https://github.com/Textualize/textual/issues/3733"""

from textual.app import App, ComposeResult
from textual.widgets import OptionList

class LoadingOverlayRedux(App[None]):

CSS = """
OptionList {
scrollbar-gutter: stable;
width: 1fr;
height: 1fr;
}
"""

BINDINGS = [
("space", "toggle")
]

def compose(self) -> ComposeResult:
yield OptionList(*[
("X" * 500) for _ in range(1_000)
])

def action_toggle(self) -> None:
self.query_one(OptionList).loading = not self.query_one(OptionList).loading

if __name__ == "__main__":
LoadingOverlayRedux().run()

### loading_overlay_redux.py ends here

0 comments on commit 43a4b62

Please sign in to comment.