Skip to content

Commit e526daf

Browse files
committed
fix content setter
1 parent 1186db8 commit e526daf

File tree

1 file changed

+8
-0
lines changed

1 file changed

+8
-0
lines changed

src/textual/widgets/_static.py

Lines changed: 8 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -53,6 +53,13 @@ def __init__(
5353

5454
@property
5555
def visual(self) -> Visual:
56+
"""The visual to be displayed.
57+
58+
Note that the visual is what is ultimately rendered in the widget, but may not be the
59+
same object set with the `update` method or `content` property. For instance, if you
60+
update with a string, then the visual will be a [Content][textual.content.Content] instance.
61+
62+
"""
5663
if self._visual is None:
5764
self._visual = visualize(self, self._content, markup=self._render_markup)
5865
return self._visual
@@ -64,6 +71,7 @@ def content(self) -> VisualType:
6471

6572
@content.setter
6673
def content(self, content: VisualType) -> None:
74+
self._content = content
6775
self._visual = visualize(self, content, markup=self._render_markup)
6876
self.clear_cached_dimensions()
6977
self.refresh(layout=True)

0 commit comments

Comments
 (0)