Skip to content
Discussion options

You must be logged in to vote

Regarding getting the button's name, or any other attribute, the event has an input property which is the RadioSet that caused the event, and RadioSet has a pressed_button and pressed_index property; the former for people who need to get at the button itself, the latter for people who only care about the index of the button pressed. So an example of doing what you want would be:

from textual.app     import App, ComposeResult
from textual.widgets import Header, Footer, RadioSet, RadioButton, Label

class RadioSetButtonApp( App[ None ] ):

    CSS = """
    Screen {
        align: center middle;
    }

    RadioSet {
        width: 50%;
    }
    """

    def compose( self ) -> ComposeResult:…

Replies: 4 comments 9 replies

Comment options

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

@davep
Comment options

Comment options

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

@davep
Comment options

Comment options

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

@learnbyexample
Comment options

@davep
Comment options

@davep
Comment options

Answer selected by learnbyexample
Comment options

You must be logged in to vote
1 reply
@learnbyexample
Comment options

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