rt
#恢复和撤销操作
from tkinter import *
root=Tk()
text=Text(root,width=30,height=5,undo=True)#默认undo是没有开启的
text.pack()
text.insert(INSERT,'I love FishC.com!')
def show():
text.edit_undo() #撤销最近一次操作
Button(root,text='撤销',command=show).pack()
mainloop()