-
Hi! I'm playing with the recently added The following code doesn't toggle the widget: def on_key(self, event: Key):
self.query_one("#checkbox-0", Checkbox).toggle() While this does: def on_mount(self):
self.query_one("#checkbox-0", Checkbox).toggle() |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 2 replies
-
Do you think you could post a minimal working example of code that shows the issue you're seeing? I just tested with this: from textual.app import App, ComposeResult
from textual.widgets import Header, Footer, Checkbox
class CBKeyToggleApp( App[ None ] ):
CSS = """
Screen {
align: center middle;
}
"""
def compose( self ) -> ComposeResult:
yield Header()
yield Checkbox("This is a test Checkbox", id="toggle-me")
yield Footer()
def on_key(self) -> None:
self.query_one("#toggle-me", Checkbox).toggle()
if __name__ == "__main__":
CBKeyToggleApp().run() and it toggles the Could you also post details of the exact steps you're taking too? For example, I can reproduce the issue you're seeing if I:
In this case the above would be the expected behaviour because those are the key bindings for toggling a |
Beta Was this translation helpful? Give feedback.
Do you think you could post a minimal working example of code that shows the issue you're seeing? I just tested with this:
and it toggles the
Checkbox
just fine on any key.Could you also po…