We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
App.notify
If you run the app below and press space, it will crash.
space
from textual.app import App, ComposeResult from textual.widgets import Label class NotifyCrash(App[None]): def compose(self) -> ComposeResult: yield Label("Press Space to crash!") def key_space(self) -> None: json = '{"booleans": [true, false]}' self.notify(json) if __name__ == "__main__": NotifyCrash().run()
It doesn't crash if I escape markup using textual.markup.escape, like this: self.notify(escape(json)).
textual.markup.escape
self.notify(escape(json))
Confirmed on Textual 2.1.1 and 1.0.0.
The text was updated successfully, but these errors were encountered:
The notify treats [true, false] as markup.
notify
[true, false]
The solution is:
from textual.app import App, ComposeResult from textual.widgets import Label from textual.markup import escape class NotifyCrash(App[None]): def compose(self) -> ComposeResult: yield Label("Press Space to crash!") def key_space(self) -> None: json = '{"booleans": [true, false]}' self.notify(escape(json)) if __name__ == "__main__": NotifyCrash().run()
BTW, notify's parameter message can parse markup, but the '[red]hello' works well, the '[#ff0]hello' raises error.
message
'[red]hello'
'[#ff0]hello'
from textual.app import App class MyApp(App): def key_q(self): self.notify(message='[red]hello') def key_w(self): self.notify(message='[#ff0]hello') if __name__ == '__main__': app = MyApp() app.run()
Sorry, something went wrong.
No branches or pull requests
If you run the app below and press
space
, it will crash.It doesn't crash if I escape markup using
textual.markup.escape
, like this:self.notify(escape(json))
.Confirmed on Textual 2.1.1 and 1.0.0.
The text was updated successfully, but these errors were encountered: