Skip to content
Discussion options

You must be logged in to vote

It's a little tricky to help here as it's not clear what all if your code is doing, but I would question the suggestion that fetch_some_data "runs again". If you're using switch_screen to switch between screens, you're going to be switching between existing instances, and so compose will only be called once for each screen. You can confirm this with this little example:

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

class Info(Screen):

    BINDINGS = [
        ("space", "switch_screen('home')"),
    ]

    def compose(self) -> ComposeResult:
        self.app.bell()
        yield Label("This is the info screen.")


class Home(

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@MuongKimhong
Comment options

Answer selected by MuongKimhong
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