modifier-key

matplotlib: How to pick up shift click on figure?

岁酱吖の 提交于 2021-02-07 06:57:16
问题 I have a matplotlib and I have created a button_press_event like this: self.fig.canvas.mpl_connect('button_press_event', self.onClick) def onClick(self, event) if event.button == 1: # draw some artists on left click elif event.button == 2: # draw a vertical line on the mouse x location on wheel click elif event.button == 3: # clear artists on right click Now is it possible to modify the wheel click handler to something like this elif event.button == 2 or (event.button == 1 and event.key ==

How can I capture Ctrl+Shift+N?

独自空忆成欢 提交于 2020-01-14 02:51:27
问题 With the help of some of the Cyberintelligensia, I am now able to use combinations of Ctrl+[some displayable key], Ctrl+Shift+[some displayable key], and Ctrl+Shift+Alt+[some displayable key] to add accented chars into a textbox. The question and its answers are here. However, there is still one recalcitrant combination. I used CodeCaster's suggestion to add a call to "Debug.WriteLine(keyData);" to see what in tarnation was being pressed (which keys). This works fine in most cases; for

How to use multiple modifier keys in C#

こ雲淡風輕ζ 提交于 2020-01-09 03:43:26
问题 I am using a keydown event to detect keys pressed and have several key combinations for various operations. if (e.KeyCode == Keys.C && e.Modifiers == Keys.Control && e.Modifiers == Keys.Shift) { //Do work } else if (e.KeyCode == Keys.V && e.Modifiers == Keys.Control) { //Paste } For some reason the key combination in which I hit Ctrl + Shift + C is not working. I have re ordered them, and placed it at the top thinking it might be interference from the Ctrl + C , and even removed the Ctrl + C

emacs create key modifier

十年热恋 提交于 2020-01-02 05:21:08
问题 I am using emacs on mac os. I would like to map a modifier (Meta, Control,...) to a simple key. Basically this is what I need : (global-set-key (kbd "a") 'hyper) Here a is just the a key, no Control-a or whatever, just "a" alone whithout modifier. I want "a" to become hyper for example but I can't find a solution for this. Someone have a clue ? 回答1: This approach won't make a modifier key in the sense that you press another key with the modifier held down, but it lets you use hyper bindings

Multiple Keys in KeyEvent Listener

血红的双手。 提交于 2019-12-25 02:44:07
问题 I was wondering how to get all of the keys pressed in a key event. For example, I want to write a listener for ctrl + f that would toggle fullscreen. How could I check if both ctrl and f are pressed in one event? EDIT 1: I tried printing KeyEvent.getModifiersExText(e.getModifiersEx()) and typing ctrl + f , but that just yielded ? . 回答1: To be honest, KeyListener has many limitations and is cumbersome to use (IMHO), instead, I would simply take advantage of the key bindings API, which

Userscript for creating a confirmation popup whenever submitting an issue or posting a comment via pressing Ctrl+Enter(the built-in hotkey) in GitHub

自作多情 提交于 2019-12-24 07:17:17
问题 Test URL: https://github.com/darkred/test/issues/new GitHub allows in the issues area for a public repo: submitting a new issue with just 1 character as title and no body, and posting a comment with just 1 character . The above happens to me quite a lot because the build-in hotkey for 'submiting an issue or comment' is Ctrl + Enter : I accidentally press that keyboard shortcut before my issue/comment text is ready. So, I'm trying to make a script (using Greasemonkey) that would show a

Check modifierFlags of NSEvent if a certain modifier was pressed but no other

心已入冬 提交于 2019-12-18 11:49:56
问题 I just experimented with the addLocalMonitorForEventsMatchingMask:handler: method in NSEvent and came across the following question: How do I find out if only certain modifiers were pressed? A short example to set this question into context: I wanted to listen for the shortcut "⌘+W". Therefore I wrote the following code: [NSEvent addLocalMonitorForEventsMatchingMask:NSKeyDownMask handler:^(NSEvent *theEvent) { if ([theEvent modifierFlags] & NSCommandKeyMask && [theEvent keyCode] == 13) {

How can I respond to a keyboard chord and replace the entered alpha key with a special one?

僤鯓⒐⒋嵵緔 提交于 2019-12-13 23:07:24
问题 I want to, in a textbox on a WinForms app using C#, replace certain keyboard chords with special characters. For example, if the user enters "Ctrl+A", I want to insert into the textbox the character "á"; if the user enters "Ctrl+Shift+A", I want to insert into the textbox the character "Á", etc. Based on what I found here, I started off with this: private void textBox_KeyDown(object sender, KeyEventArgs keArgs) { bool useHTMLCodes = checkBoxUseHTMLCodes.Checked; String replacement = null; if

detect/get notification if shift key (modifier-key) pressed in uitextview

放肆的年华 提交于 2019-12-09 13:19:11
问题 I'm trying to figure out if there is any way in which we can detect if shift key is pressed or if any notification is sent when shift key is pressed in UIKeyboard - (BOOL) textView:(UITextView *)textView shouldChangeTextInRange:(NSRange)range replacementText:(NSString *)string does not get called for shift key press since it is a modifier key. 回答1: Don't know whether you need to know it in combination with other text or only detect the single shift tap, but here is my solution for detecting

How to hold the Ctrl key down through code

99封情书 提交于 2019-12-07 17:21:59
问题 I'm writing a unit test and a certain function will be called deep down in the stack if (Control.ModifierKeys == Keys.Control).. I can add a flag or something for the particular case of running a unit test, but it would be too dirty! How can I set ModifierKeys to Ctrl through code? I'm using C#.Net 4.0. 回答1: You could use P/Invoke to call the keybd_event function for synthesizing keystrokes. First declare the following: [DllImport("user32.dll", SetLastError = true)] static extern void keybd