作者neil987 (R5大小姐-EX人品崩坏)
看板Python
标题[问题] ttk Combobox能否知道选择第几项?
时间Mon May 22 06:37:36 2017
最近在用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
--
※ 发信站: 批踢踢实业坊(ptt.cc), 来自: 219.68.10.154
※ 文章网址: https://webptt.com/cn.aspx?n=bbs/Python/M.1495406259.A.986.html
1F:→ neil987: 自问自答-.- 只要用matchChosen.current()就抓到了 05/22 06:45