在Tkinter Text小部件中撤消和重做功能?

时间:2010-07-02 21:56:52

标签: python tkinter undo undo-redo redo

我需要同时制作 Control + Z Shift + Control + Z < / kbd>在Tkinter Text小部件中的功能,以便可以撤消和重做事物。

有没有人知道如何做到这一点?

2 个答案:

答案 0 :(得分:4)

The tkinter Text widget supports undo and redo operations using a stack

在以下链接中,您可以找到更多信息:

  

http://www.tkdocs.com/tutorial/text.html#more

否则,您可以查看Text窗口小部件的tkinter或Tk文档以及如何创建对某些键的绑定。您需要的tkinter Text小部件功能是edit_undo

答案 1 :(得分:2)

Tkinter Text小部件已经支持使用Control + Z进行撤消,使用Shift + Control + Z进行重做,但您必须使用autoseparators=True在小部件上启用它们。您可能还想使用maxundo=-1@Component @Scope(value = WebApplicationContext.SCOPE_REQUEST, proxyMode = ScopedProxyMode.TARGET_CLASS) @JsonIgnoreProperties(ignoreUnknown = true) public class Subject { @JsonProperty("cis_uuid") protected String uid; @JsonProperty("token_type") protected String tokenType; public String toString() { return uid + " "+ tokenType; } } 。请参阅http://infohost.nmt.edu/tcc/help/pubs/tkinter/web/text-undo-stack.htmlhttps://www.tcl.tk/man/tcl8.5/TkCmd/text.htm#M65

相关问题