Skip to content
Discussion options

You must be logged in to vote

Try this...

You will probably need the v0.19.1 which has a fix for data table refreshing.

import asyncio


from textual import work
from textual.app import App, ComposeResult
from textual.widgets import DataTable, LoadingIndicator


class TableApp(App):
    def compose(self) -> ComposeResult:
        yield LoadingIndicator()
        yield DataTable()

    def on_mount(self) -> None:
        table = self.query_one(DataTable)
        table.display = False
        self.load_data()

    @work
    async def load_data(self):
        await asyncio.sleep(3)  # Simulate time to load the data

        data: list[tuple] = [
            ("lane", "swimmer", "country", "time"),
            (4, "Joseph …

Replies: 3 comments 10 replies

Comment options

You must be logged in to vote
6 replies
@TomJGooding
Comment options

TomJGooding Apr 10, 2023
Collaborator Author

@willmcgugan
Comment options

Answer selected by TomJGooding
@TomJGooding
Comment options

TomJGooding Apr 10, 2023
Collaborator Author

@TomJGooding
Comment options

TomJGooding Apr 10, 2023
Collaborator Author

@vigne-Sh
Comment options

@TomJGooding
Comment options

TomJGooding Sep 1, 2023
Collaborator Author

Comment options

You must be logged in to vote
2 replies
@TomJGooding
Comment options

TomJGooding Sep 18, 2023
Collaborator Author

@vigne-Sh
Comment options

Comment options

You must be logged in to vote
2 replies
@ptmcg
Comment options

@ptmcg
Comment options

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
4 participants