Replies: 2 comments 4 replies
-
I think the simplest way would be to use from rich.text import Text
from textual.app import App, ComposeResult, RenderResult
from textual.widget import Widget
class TextClick(Widget):
def render(self) -> RenderResult:
return Text.from_markup("[@click=hello]Click me![/]")
def action_hello(self) -> None:
self.notify("Hello, World!")
class ExampleApp(App):
def compose(self) -> ComposeResult:
yield TextClick()
if __name__ == "__main__":
app = ExampleApp()
app.run() |
Beta Was this translation helpful? Give feedback.
2 replies
-
Beta Was this translation helpful? Give feedback.
2 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
I can add @click to regular strings no issue:
row_data.append(f"[@click=app.exit_app('blue')]{column.formatter.format(value)}[/]")
But i've tried to add to Text() objects without luck. Is it possible?
Thanks
Beta Was this translation helpful? Give feedback.
All reactions