Path 1: 1 calls (1.0)

{'foo': 'bar'} (1)

{'click': 'CLICK'} (1)

Text (1)

1def on(self, meta: Optional[Dict[str, Any]] = None, **handlers: Any) -> "Text":
2        """Apply event handlers (used by Textual project).
3
4        Example:
5            >>> from rich.text import Text
6            >>> text = Text("hello world")
7            >>> text.on(click="view.toggle('world')")
8
9        Args:
10            meta (Dict[str, Any]): Mapping of meta information.
11            **handlers: Keyword args are prefixed with "@" to defined handlers.
12
13        Returns:
14            Text: Self is returned to method may be chained.
15        """
16        meta = {} if meta is None else meta
17        meta.update({f"@{key}": value for key, value in handlers.items()})
18        self.stylize(Style.from_meta(meta))
19        return self