I’m writing a source code editor, and I want to disable any of the pre-defined keystrokes, e.g Ctrl-V for paste, how can I do that?
Share
Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.
Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.
Lost your password? Please enter your email address. You will receive a link and will create a new password via email.
Please briefly explain why you feel this question should be reported.
Please briefly explain why you feel this answer should be reported.
Please briefly explain why you feel this user should be reported.
I have found the way to do this: Return boolean
Truefrom the method which handles thekey-press-event. Any value that doesn’t evaluate to true passes control back to Gtk.In the particular way I implement this editor, the
key-press-eventsignal of the toplevel vindow is connected to the method__key_event_handler, which basically filters all the keystrokes, modified with either Ctrl or Alt keys and returns True after processing the input, or just passes the control back to Gtk otherwise. This way, I can manage all the modified keystrokes, which are meant to be editor commands, and not need to handle insertion of normal characters.