6,029
社区成员
发帖
与我相关
我的任务
分享
import tkinter as tk
def a():
text.insert(0.0,"114514\n")
def b():
print(text.get("1.0",tk.END))
def c():
text.delete(1.0,tk.END)
root=tk.Tk()
scrollbar=tk.Scrollbar(root)
scrollbar.pack(side=tk.RIGHT,fill=tk.Y)
text=tk.Text(root,padx=40,pady=10)
text.pack()
button1=tk.Button(root,text="插入",command=a)
button1.pack()
button2=tk.Button(root,text="获取",command=b)
button2.pack()
button3=tk.Button(root,text="清空",command=c)
button3.pack()
scrollbar.configure(command=text.yview)
root.mainloop()