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#4224
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Feb 27, 2024
1 parent 3409037 commit 9b2921a
Showing 1 changed file with 22 additions and 0 deletions.
22 changes: 22 additions & 0 deletions leaky_select.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,22 @@
"""Example for https://github.com/Textualize/textual/issues/4224"""

from textual import on
from textual.app import App, ComposeResult
from textual.widgets import Log, OptionList, Select


class LeakySelectApp(App[None]):
def compose(self) -> ComposeResult:
yield Log()
yield OptionList(*(f"This is option {n}" for n in range(10)))
yield Select[int](((f"This is selection {n}", n) for n in range(10)))

@on(OptionList.OptionHighlighted)
def log_some_option(self, event: OptionList.OptionHighlighted) -> None:
self.query_one(Log).write_line(f"{event}")


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

### leaky_select.py ends here

0 comments on commit 9b2921a

Please sign in to comment.