第七色在线视频,2021少妇久久久久久久久久,亚洲欧洲精品成人久久av18,亚洲国产精品特色大片观看完整版,孙宇晨将参加特朗普的晚宴

為了賬號安全,請及時綁定郵箱和手機立即綁定
已解決430363個問題,去搜搜看,總會有你想問的

Tkinter AutoEntry

Tkinter AutoEntry

湖上湖 2022-10-18 17:18:14
我正在嘗試在 Tkinter 中進行 AutoEntry(在您進行研究時獲取單詞列表以提供像 Google 一樣的自動完成功能)。但是,我似乎在網(wǎng)上找不到任何簡單的例子。本教程在開頭 ( http://appjar.info/inputWidgets/ ) 中提到了 AutoEntry,但沒有提供示例。這是我想創(chuàng)建的 AutoEntry 示例: 示例有人有初學者的例子嗎?
查看完整描述

1 回答

?
慕森王

TA貢獻1777條經(jīng)驗 獲得超3個贊

這里有一些東西,我想你正在尋找......并且你會以按鈕的形式獲得建議,以便你可以從中進行選擇。


from tkinter import *

from tkinter import ttk

root = 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()


查看完整回答
反對 回復 2022-10-18
  • 1 回答
  • 0 關(guān)注
  • 98 瀏覽
慕課專欄
更多

添加回答

舉報

0/150
提交
取消
微信客服

購課補貼
聯(lián)系客服咨詢優(yōu)惠詳情

幫助反饋 APP下載

慕課網(wǎng)APP
您的移動學習伙伴

公眾號

掃描二維碼
關(guān)注慕課網(wǎng)微信公眾號