Skip to content
Discussion options

You must be logged in to vote

Exactly how you go about it will depend on the nature of your code that gets the data, etc; but normally I'd do it using some form of worker in conjunction with returning data from screens:

from time import sleep

from textual import work
from textual.app import App, ComposeResult
from textual.screen import Screen
from textual.widgets import Label, LoadingIndicator


class LoadSomeStuff(Screen[str]):

    DEFAULT_CSS = """
    LoadSomeStuff {
        LoadingIndicator {
            height: 1fr;
        }
    }
    """

    def compose(self) -> ComposeResult:
        yield Label("Just wait a wee while, we'll be done soon.")
        yield LoadingIndicator()

    @work(thread=True)
    def lo…

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by ishaan-ghosh
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants