慕森王
这里有一些东西,我想你正在寻找......并且你会以按钮的形式获得建议,以便你可以从中进行选择。from tkinter import *from tkinter import ttkroot = Tk()l = ['den', 'do', 'dear', 'disco', 'dream']def select(w): global e, f e.delete(0, END) e.insert(0, w) f.destroy()def callback(sv): global f f.destroy() f = Frame(root) f.pack() for words in l: entry = e.get() print(entry) x = words y = '' for c in x: if x.isalpha(): y += c if y == entry: Button(f, text=words, command=lambda word=words: select(word)).grid(sticky=W+E) #Label(f, text=words).pack() print(words)sv = StringVar()sv.trace("w", lambda name, index, mode, sv=sv: callback(sv))e = Entry(root, textvariable=sv)e.pack()f = Frame(root)f.pack()root.mainloop()