嗨〜我在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代碼.. –