Skip to content
Discussion options

You must be logged in to vote

I feel you're trying to do a little more with RadioSet than it was intended to do. If I wanted a RadioSet whose content depended on the state of some other part of my application, I'd probably take an approach where I remove the existing one and mount fresh one in its place with the desired buttons.

As an illustration:

from textual import on
from textual.app import App, ComposeResult
from textual.containers import Vertical
from textual.widgets import RadioSet, Select

class DynamicRadioSetApp(App[None]):

    def compose(self) -> ComposeResult:
        yield Select[int]((("The Beatles", 0), ("Radiohead", 1),("REM", 2)))
        with Vertical(id="band-picker"):
            yield RadioSet()…

Replies: 1 comment 2 replies

Comment options

You must be logged in to vote
2 replies
@davep
Comment options

@lauralindzey
Comment options

Answer selected by lauralindzey
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants