📌  相关文章
📜  如何获取条目中的单词 tkinter python 代码示例

📅  最后修改于: 2022-03-11 14:47:13.376000             🧑  作者: Mango

代码示例1
import tkinter as tk
from tkinter import ttk

win = tk.Tk()

v = tk.StringVar()
def setText(word):
    v.set(word)

a = ttk.Button(win, text="plant", command=setText("plant"))
a.pack()
b = ttk.Button(win, text="animal", command=setText("animal"))
b.pack()
c = ttk.Entry(win, textvariable=v)
c.pack()
win.mainloop()