-
Notifications
You must be signed in to change notification settings - Fork 818
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'main' into toggle-style-order
- Loading branch information
Showing
11 changed files
with
337 additions
and
18 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,21 @@ | ||
from textual.app import App, ComposeResult | ||
from textual.reactive import reactive | ||
from textual.widgets import Input, Label | ||
|
||
|
||
class MultiGreet(App): | ||
names: reactive[list[str]] = reactive(list, recompose=True) # (1)! | ||
|
||
def compose(self) -> ComposeResult: | ||
yield Input(placeholder="Give me a name") | ||
for name in self.names: | ||
yield Label(f"Hello, {name}") | ||
|
||
def on_input_submitted(self, event: Input.Changed) -> None: | ||
self.names.append(event.value) | ||
self.mutate_reactive(MultiGreet.names) # (2)! | ||
|
||
|
||
if __name__ == "__main__": | ||
app = MultiGreet() | ||
app.run() |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.