Default reprogramming in tkinter

I am adding a binding to my root window (an instance Tk()that contains a text widget):

root.bind("Control-o", setconnpanelopen)

The problem is that, control-oby default, it binds to "insert newline", so my procedure fires, but it also inserts a new line! This happens even if I put it return 'break'in the end - so it works earlier, so it seems.

1) how can I reassign this behavior?

2) I have not found a list of standard keybindingstext widgets anywhere - are they available somewhere?

+4
source share
2 answers

"bindtags" - tkinter.

"" ( "bindtags" ), . , : , ( , python), "",

. , , , . , , .

, . , "break" . , , , setconnpanelopen return "break". , , .

: , , . , , , , , "break", .

. http://tcl.tk/man/tcl8.5/TkCmd/text.htm#M162 - tcl/tk, , tkinter , tkinter.

+4

, . .

class MyTextWidget(Text):
    def __init__(self, master, **kw)
        Text.__init__(self, master, **kw)
        self.bind('<Control-O>', setconnpanelopen)

, setconnpanelopen "break".

: http://effbot.org/tkinterbook/tkinter-events-and-bindings.htm

0

Source: https://habr.com/ru/post/1535324/


All Articles