一 滚动text窗口
window = tk.Tk()
window.title('这里是标题')
window.geometry('500x450')
vara = tk.StringVar()
# 滚动窗口
sa = scrolledtext.ScrolledText(window, font=("黑体", 12), width=58, height=16)
sa.place(x=6, y=150)
# 回调函数
def insert_text(value):
""" 向文本框插入文本 """
sa["state"] = tk.NORMAL
sa.insert(tk.END, value + "\n")
sa.yview_moveto(1)
sa.update()
sa["state"] = tk.DISABLED
# 向窗口内添加数据
bb = tk.Button(window, text='开始执行', width=10, height=2, command=lambda : insert_text('测试数据')).place(x=6, y=80)
window.mainloop()