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
Can not update title property of the Collapsible widget , looking at CollapsibleTitle class it seems to only set at init
Looks like this was an intentional choice ?
But I think it would be helpful to make the title property editable ,
Eg: changing content in the collapsed state and don't want to toggle it open to get a quick status update, so write something in .title...
from textual.app import App, ComposeResult
from textual.containers import Container, Horizontal, VerticalScroll
from textual.widgets import Header, Footer, Collapsible, Placeholder
class AnApp(App):
TITLE = "Collapsible Titles Should Update"
BINDINGS = [("d", "toggle_dark", "Update"),
("c", "collapse_or_expand(True)", "Collapse"),
("e", "collapse_or_expand(False)", "Expand")]
def action_collapse_or_expand(self, collapse: bool) -> None:
for child in self.walk_children(Collapsible):
child.collapsed = collapse
def compose(self) -> ComposeResult:
"""Create child widgets for the app."""
yield Header(show_clock=True)
yield VerticalScroll(
Collapsible(
Horizontal(
Placeholder(variant="text"),
Placeholder(variant="size"),
Placeholder(variant="text"),
),
title="Top_Stuff",id="top"
)
)
yield Footer()
def action_toggle_dark(self) -> None:
"""An action to toggle dark mode."""
top_collapsible_widget = self.query_one("#top")
top_collapsible_widget.title = "UPDATED_Top_Stuff"
self.app.title = "UPDATED_App_Title"
self.dark = not self.dark
if __name__ == "__main__":
app = AnApp()
app.run()
The text was updated successfully, but these errors were encountered:
Can not update title property of the Collapsible widget , looking at CollapsibleTitle class it seems to only set at init
Looks like this was an intentional choice ?
But I think it would be helpful to make the title property editable ,
Eg: changing content in the collapsed state and don't want to toggle it open to get a quick status update, so write something in .title...
The text was updated successfully, but these errors were encountered: