import tkinter as tk
def insert_point():
var = e.get()
t.insert('insert', var)
def insert_end():
var = e.get()
t.insert('end', var)
window = tk.Tk()
window.title('my window')
window.geometry('200x200')
# 输入
e = tk.Entry(window, show=None)
e.pack()
b1 = tk.Button(window, text='insert point', width=15,
height=2, command=insert_point)
b1.pack()
b2 = tk.Button(window, text='insert end', width=15,
height=2, command=insert_end)
b2.pack()
# 文本框
t = tk.Text(window, height=2)
t.pack()
window.mainloop()
初始
输入数据
网友评论