Python Tkinter multiple selection Listbox

后端 未结 3 1053
梦谈多话
梦谈多话 2021-01-02 13:32

I tried a search on here but not come across the correct answer.
I have a listbox which is setup with selection=\'multiple\'. I then try to obtain a list

3条回答
  •  予麋鹿
    予麋鹿 (楼主)
    2021-01-02 14:13

    To get a list of text items selected in a listbox, I find the below solution to be the most elegant:

    selected_text_list = [listbox.get(i) for i in listbox.curselection()]
    

提交回复
热议问题