Add control to RadioSet message.

This commit is contained in:
Rodrigo Girão Serrão
2023-05-04 19:02:01 +01:00
parent 8bf5316d65
commit 9d1f0283b2
2 changed files with 10 additions and 0 deletions

View File

@@ -26,6 +26,7 @@ and this project adheres to [Semantic Versioning](http://semver.org/).
- `DirectoryTree.FileSelected`
- `ListView.Highlighted` and `ListView.Selected`
- `Markdown.TableOfContentsUpdated`, `Markdown.TableOfContentsSelected`, and `Markdown.LinkClicked`
- `RadioSet.Changed`
## [0.23.0] - 2023-05-03

View File

@@ -92,6 +92,15 @@ class RadioSet(Container, can_focus=True, can_focus_children=False):
self.index = radio_set.pressed_index
"""The index of the [`RadioButton`][textual.widgets.RadioButton] that was pressed to make the change."""
@property
def control(self) -> RadioSet:
"""A reference to the [`RadioSet`][textual.widgets.RadioSet] that was changed.
This is an alias for [`Changed.radio_set`][textual.widgets.RadioSet.Changed.radio_set]
and is used by the [`on`][textual.on] decorator.
"""
return self.radio_set
def __rich_repr__(self) -> rich.repr.Result:
yield "radio_set", self.radio_set
yield "pressed", self.pressed