mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Reduce the calls to Text when building the button
Found out that Text.assemble can take a collection of tuple of text and style, which makes things a lot easier and needs less object construction.
This commit is contained in:
@@ -151,9 +151,9 @@ class ToggleButton(Static, can_focus=True):
|
||||
)
|
||||
|
||||
return Text.assemble(
|
||||
Text(self.BUTTON_LEFT, style=side_style),
|
||||
Text(self.BUTTON_INNER, style=button_style),
|
||||
Text(self.BUTTON_RIGHT, style=side_style),
|
||||
(self.BUTTON_LEFT, side_style),
|
||||
(self.BUTTON_INNER, button_style),
|
||||
(self.BUTTON_RIGHT, side_style),
|
||||
)
|
||||
|
||||
def render(self) -> RenderResult:
|
||||
|
||||
Reference in New Issue
Block a user