Skip to content
Discussion options

You must be logged in to vote

A re-layout isn't the same as calling compose. The compose method builds your app content just the once so it's not going to be called again. To react to ready being changed you want to be using a watch method . So perhaps go with something more like this:

from textual.app import App, ComposeResult
from textual.reactive import reactive
from textual.widgets import Button

class MyApp(App):
    ready = reactive(False,init=False)

    def on_button_pressed(self, event: Button.Pressed) -> None:
        if event.button.id == 'enable':
            self.ready = True

    def watch_ready(self, ready: bool) -> None:
        self.query_one( "#do_the_thing", Button).disabled = not ready

    def com…

Replies: 1 comment 1 reply

Comment options

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

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