diff --git a/hover_letters.py b/hover_letters.py new file mode 100644 index 0000000..3bb3ca0 --- /dev/null +++ b/hover_letters.py @@ -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