[問題] ttk Combobox能否知道選擇第幾項?

作者: neil987 (R5大小姐-EX人品崩壞)   2017-05-22 06:37:36
最近在用ttk 寫一個爬蟲
首先 有兩個list:list_option_val,list_option_sub 長度一樣
用ttk叫出了一個combobox給使用者選擇
match = tk.StringVar()
matchChosen = ttk.Combobox(win, width=20, textvariable=match,
state='readonly')
matchChosen['values'] = list_option_sub
matchChosen.grid(column=0, row=1)
matchChosen.current(0)
print match.get()
基本上可以抓到使用者選擇的內容
但是主要需要的是另一個list_option_val 對應欄位的值
這值要丟給某些網址用的
請問有沒有方法可以快速知道使用者選了第幾項?
以方便我到另一個list取值
如果沒有的話就只能在回去原本的list搜尋了QQ
作者: neil987 (R5大小姐-EX人品崩壞)   2017-05-22 06:45:00
自問自答-.- 只要用matchChosen.current()就抓到了

Links booklink

Contact Us: admin [ a t ] ucptt.com