How to prevent RadioButton (that are dynamically mounted to RadioSet) from expansion animation on mouse click? #5213
-
Here's a sample program: from textual.app import App
from textual.widgets import RadioButton, RadioSet
class TestApp(App):
CSS = ''' Screen { align: center middle; } '''
def __init__(self):
super().__init__()
self.rset = RadioSet()
def compose(self):
yield RadioSet('apple', 'banana', 'cherry')
yield self.rset
def on_mount(self):
self.dark = False
rb1 = RadioButton('true')
self.rset.mount(rb1)
rb2 = RadioButton('false')
self.rset.mount(rb2)
if __name__ == "__main__":
app = TestApp()
app.run() Here's a sample video when the above program is run: rset.mp4Is there a way to prevent the RadioButtons from animating in the second case (the RadioSet with true/false choices)? For my actual use case, I need to dynamically add/remove existing RadioButtons from a RadioSet (the number of RadioButtons vary, need to show a pre-selected choice if applicable, change styling, etc - which is why I'm using |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
I didn't anticipate anyone adding a RadioButton to a RadioSet after it is mounted. That's probably easy to make that work, you might want to file an issue. In the meantime, recreating the RadioSet with your new options is probably the way to go. |
Beta Was this translation helpful? Give feedback.
I didn't anticipate anyone adding a RadioButton to a RadioSet after it is mounted. That's probably easy to make that work, you might want to file an issue.
In the meantime, recreating the RadioSet with your new options is probably the way to go.