Skip to content

Event duplication phenomenon question #5198

Closed Answered by TomJGooding
YoonSungHyun-Git asked this question in Q&A
Discussion options

You must be logged in to vote

I think the problem might be that the set_options method will also select the first valid option as noted in the docs?

I've created a quick example below which logs the Select.Changed events.

Simple example showing set_options
from textual.app import App, ComposeResult
from textual.containers import Horizontal
from textual.widgets import Button, RichLog, Select


class ExampleApp(App):
    CSS = """
    Button { width: 1fr; margin: 1;}
    """

    def compose(self) -> ComposeResult:
        yield Button("Set the options", variant="primary")
        with Horizontal():
            yield Select(
                allow_blank=False,
                options=[("Please press the button first", "…

Replies: 1 comment 6 replies

Comment options

You must be logged in to vote
6 replies
@TomJGooding
Comment options

@YoonSungHyun-Git
Comment options

@willmcgugan
Comment options

@TomJGooding
Comment options

Answer selected by YoonSungHyun-Git
@YoonSungHyun-Git
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
3 participants