FletでDropDownリストの選択された表示名を取得しようとしたら、意外と情報なかったのでメモ書き。要は、選択されたキーのオプションを探し出してtextを呼び出せばいいということらしい。もっとシンプルな方法ないのかな?
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
def dropdown_changed(e): | |
selected_fruit = e.control.value | |
for option in dropdown.options: | |
if(selected_fruit == option.key): | |
print(option.text) //表示名 | |
print(option.key) //値 | |
break |
0 件のコメント:
コメントを投稿