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#4089
Browse files Browse the repository at this point in the history
  • Loading branch information
davep committed Feb 1, 2024
1 parent bd42b0b commit 62998e6
Showing 1 changed file with 33 additions and 0 deletions.
33 changes: 33 additions & 0 deletions hover_letters.py
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
"""https://github.com/Textualize/textual/discussions/4089"""

from random import choice
from string import ascii_uppercase

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

class HoverLettersApp(App[None]):

CSS = """
Static {
link-style: none;
link-color-hover: white;
link-background-hover: red;
}
"""

def compose(self) -> ComposeResult:
text = ""
for _ in range(5000):
letter = choice(ascii_uppercase)
text += f"[@click=does_nothing('{letter}')]{letter}[/]"
yield Static(text)

def action_does_nothing(self) -> None:
pass


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

### hover_letters.py ends here

0 comments on commit 62998e6

Please sign in to comment.