From 3545b8cdfeb4b9ae60950fe637a3066f06c4c635 Mon Sep 17 00:00:00 2001 From: Dave Pearson Date: Tue, 14 Nov 2023 15:35:20 +0000 Subject: [PATCH] :sparkles: Example of https://github.com/Textualize/textual/issues/3677 --- loading_overlay.py | 30 ++++++++++++++++++++++++++++++ 1 file changed, 30 insertions(+) create mode 100644 loading_overlay.py diff --git a/loading_overlay.py b/loading_overlay.py new file mode 100644 index 0000000..747f52a --- /dev/null +++ b/loading_overlay.py @@ -0,0 +1,30 @@ +"""https://github.com/Textualize/textual/issues/3677""" + +from textual.app import App, ComposeResult +from textual.widgets import Label + +class LoadingOverlayApp(App[None]): + + CSS = """ + Label { + width: 90%; + height: 1fr; + text-align: center; + border: solid red; + } + """ + + def compose(self) -> ComposeResult: + yield Label("This is a really big label") + + def on_mount(self) -> None: + self.notify( + "This is a really big notification. Loading should not overwrite it.", + timeout=9_999_999 + ) + self.query_one(Label).loading = True + +if __name__ == "__main__": + LoadingOverlayApp().run() + +### loading_overlay.py ends here