Skip to content

inconsistent behavior Select Widged #2557

@dominikhoebert

Description

@dominikhoebert

Getting very inconsistent behavior with the new Select Widged when using their .set_options. Often after the options stay empty, depending on if the Select was used before, an item was selected before or not, or the options before where empy ([]).

from textual import on
from textual.app import App, ComposeResult
from textual.widgets import Select, Button


class SelectBug(App):

    def compose(self) -> ComposeResult:
        self.select = Select(options=[("empty", 0)])
        yield self.select
        yield Button("Change Options", id="change_options")

    @on(Button.Pressed, "#change_options")
    def change_options(self, event):
        self.select.set_options([("Four", 4), ("Five", 5), ("Six", 6)])


if __name__ == "__main__":
    app = SelectBug()
    app.run()

Keep the great work up!

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions