Select widget with default value already selected #3381
-
I don't think it is possible yet to have a Select with a default value already selected when the widget is mounted, would it be a good idea ? Should I create a pr? |
Beta Was this translation helpful? Give feedback.
Replies: 3 comments 2 replies
-
You can set the |
Beta Was this translation helpful? Give feedback.
-
Isn't it weird that you must set the Imagine having for example a list of countries with data associated to it ( an option would be |
Beta Was this translation helpful? Give feedback.
-
Thank you, now I understand. Also, is it normal that when the from textual.widgets import Select
from textual.app import App
def do_nothing(x):
pass
class Test(App):
def compose(self):
select = Select(options=[("France", "fr")], value="fr")
# When the line below is executed, the select widget doesn't have any default value but it should
do_nothing(select.value)
yield select
app = Test()
app.run() |
Beta Was this translation helpful? Give feedback.
You can set the
value
parameter on the constructor