嗨〜我在python gui中使用tkinter。我的代码是列表框wdiget。我想添加与列表框小部件的过滤器。 但我不知道它没有。我该如何做才能做到这一点。 我想添加过滤器..我不知道这样做.. 请帮我。我不知道make search_data()。如何在tkiter中添加过滤器小部件?
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()
_“你需要用......” - 什么是“......”? –
更新了它 - 希望这可以让它更容易理解。 “sth”应该是“something” – R4PH43L
的缩写,谢谢你的回答。但我的英文不好...你是否显示代码..不是seudo代码.. –