-
-
Notifications
You must be signed in to change notification settings - Fork 1.1k
Closed as not planned
Description
In following code, when I click button'1' ,its parent widget which is horizontal container runs toggle("disabled") but not button'1'.
But, when I click button'2', button'2' runs toggle("disabled"). Do I miss something? https://textual.textualize.io/guide/actions/#namespaces says Textual will look for action methods in the class where they are defined (App, Screen, or Widget), This makes me confused. Thanks someone who can help me in advance.
from textual.app import App
from textual.widgets import Button
from textual.containers import Horizontal
class MyApp(App):
def on_mount(self):
self.widgets = [
Horizontal(
Button('1',action='toggle("disabled")'),
Button('2',action='focused.toggle("disabled")'),
Button('3')
),
Button('4')
]
self.mount_all(self.widgets)
if __name__ == '__main__':
app = MyApp()
app.run()Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels