You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Hi. This is a simple request to add simpler way to use data_bind on dynamically mounted widgets. Take a look at the sample code below please.
fromtextual.appimportApp, ComposeResultfromtextual.widgetsimportLabelfromtextual.reactiveimportreactivefromtextual.widgetimportWidgetclassL3(Widget):
animal_sound=reactive("Meow")
defcompose(self) ->ComposeResult:
yieldLabel(self.animal_sound*3)
classL2(Widget):
animal_sound=reactive("Woof")
defcompose(self) ->ComposeResult:
yieldLabel(self.animal_sound*2)
yieldL3()
defon_focus(self, event: Focus):
new_L3=L3()
new_L3.animal_sound="Hmmm"# How Can I bind L3's animal_sound to MainApp's animal sound directly?new_L3.data_bind(self.parent.animal_sound) # Would be so great if we could use objects to bind reactives instead of classesself.mount(new_L3)
classMainApp(App):
animal_sound=reactive("Woof")
defcompose(self) ->ComposeResult:
yieldLabel("Sorry if this question is dumb")
yieldL2()
MainApp().run()
Thanks in advance!
The text was updated successfully, but these errors were encountered:
Hi. This is a simple request to add simpler way to use data_bind on dynamically mounted widgets. Take a look at the sample code below please.
Thanks in advance!
The text was updated successfully, but these errors were encountered: