mirror of
https://github.com/Textualize/textual.git
synced 2025-10-17 02:38:12 +03:00
Remove unecessary validate method call, stylize button properly
This commit is contained in:
@@ -61,7 +61,7 @@ class Button(Widget, can_focus=True):
|
|||||||
if label is None:
|
if label is None:
|
||||||
label = self.css_identifier_styled
|
label = self.css_identifier_styled
|
||||||
|
|
||||||
self.label: Text = self.validate_label(label)
|
self.label: Text = label
|
||||||
|
|
||||||
self.disabled = disabled
|
self.disabled = disabled
|
||||||
if disabled:
|
if disabled:
|
||||||
@@ -76,7 +76,9 @@ class Button(Widget, can_focus=True):
|
|||||||
return label
|
return label
|
||||||
|
|
||||||
def render(self, style: Style) -> RenderableType:
|
def render(self, style: Style) -> RenderableType:
|
||||||
return Text.styled(self.label.plain, style)
|
label = self.label.copy()
|
||||||
|
label.stylize(style)
|
||||||
|
return label
|
||||||
|
|
||||||
async def on_click(self, event: events.Click) -> None:
|
async def on_click(self, event: events.Click) -> None:
|
||||||
event.stop()
|
event.stop()
|
||||||
|
|||||||
Reference in New Issue
Block a user