【发布时间】:2016-04-19 18:19:58
【问题描述】:
嗨~我在 python gui 中使用 tkinter。我的代码是列表框 wdiget。我想添加带有列表框小部件的过滤器。 但我不知道让它不。我该怎么做才能做到这一点。 我想添加过滤器..我不知道那样做.. 请帮帮我。我不知道make search_data()。
from tkinter import *
def search_data():
print('d')
root=Tk()
dd = Frame(root, borderwidth=0 )
# create the entry widget
entry_value = StringVar()
entry = Entry(dd, textvariable=entry_value)
entry.pack(side=LEFT) # where ever you want it
Button(dd, text = 'search ', command = search_data).pack(side=LEFT)
dd.pack()
scrollbar=Scrollbar(root)
scrollbar.pack(side=RIGHT,fill=Y)
mylist=Listbox(root,yscrollcommand=scrollbar.set, width=100, height=15)
for line in range(100):
mylist.insert(END,"This is line number " + str(line))
mylist.pack(side=LEFT,fill=BOTH)
scrollbar.config(command=mylist.yview)
mainloop()
【问题讨论】:
标签: python python-3.x tkinter