key-bindings

Detecting Key Presses using win32api in Python

a 夏天 提交于 2019-12-17 16:43:26
问题 I'm trying to break a loop in Python with a specific key press using win32api. How would one go about this? What is the actual version of win32api.KeyPress('H') , in the following code? Revised: import win32api while True : cp = win32api.GetCursorPos() print cp if win32api.KeyPress('H') == True : break I want to be able to break a loop by pressing the h key. Edit: I'm attempting to make a program that repeatedly reports mouse positions and I need a mechanism to exit said program. See revised

Why the key binding M-S-t fails while C-S-t works?

余生颓废 提交于 2019-12-17 14:55:13
问题 I got the question from this question, it seems we can't bind shift with meta like M-S-t (always translated to M-t ), but we can do it with control like C-S-t (works as C-T ). As the accepted answer said, we can use M-T instead, but why we can't use it with meta ? Does Emacs just ignore shift when used with meta ? 回答1: I think Emacs ignores S- for letters when Ctrl is not also used. i.e. it's nothing to do with Meta in particular; the same thing applies to the other non-Ctrl modifiers (and

How do I bind the enter key to a function in tkinter?

丶灬走出姿态 提交于 2019-12-17 06:08:14
问题 I am a Python beginning self-learner, running on MacOS. I'm making a program with a text parser GUI in tkinter, where you type a command in a Entry widget, and hit a Button widget, which triggers my parse() funct, ect, printing the results to a Text widget, text-adventure style. > Circumvent the button I can't let you do that, Dave. I'm trying to find a way to get rid of the need to haul the mouse over to the Button every time the user issues a command, but this turned out harder than I

Binding M-<up> / M-<down> in Emacs 23.1.1

天涯浪子 提交于 2019-12-17 05:02:14
问题 I'm trying to put in a feature that I miss from Eclipse, where Alt +[ Up / Down ] transposes the lines up or down, but can not for the life of me figure out how to assign to these keys properly. I am using it in -nw mode (so just in a shell window), and typically run in a screen session. Using a global key binding, I can get it to work with letter combinations, like (kbd "M-m") , but every combination I have tried for the arrow keys just gives me a message that doesn't make sense, I always

Why does Ctrl+. not work when I bind it to a command in Emacs?

送分小仙女□ 提交于 2019-12-17 04:02:02
问题 C-. doesn't work in the terminal when I bind it to a command in Emacs. I tried this procedure on gnome-terminal and real terminal tty1. I start Emacs with the -nw flag, then press C-h k (the command for describe-key ), then press C-. . Emacs only receives the . , without the Ctrl . How do I get this working in Emacs? I'm binding keys with this process: (define-key c-mode-base-map (kbd "C-.") 'semantic-ia-fast-jump) or (define-key c-mode-base-map [(control .)] 'semantic-ia-fast-jump) 回答1: In

visual studio code keybindings - Running two or more commands with one shortcut

时光毁灭记忆、已成空白 提交于 2019-12-14 03:43:48
问题 I have the following keybinding in VS code which toggles the position of the cursor between the active document and built-in terminal: // Toggle between terminal and editor focus { "key": "oem_8", "command": "workbench.action.terminal.focus" }, { "key": "oem_8", "command": "workbench.action.focusActiveEditorGroup", "when": "terminalFocus" } Before i click the shortcut key to move the cursor to the terminal, i first have to save the active file. I would therefore like to run the file saving

How do I access the name of the action defined in a Java key binding?

笑着哭i 提交于 2019-12-13 21:58:22
问题 This code works well for me to make key bindings more pleasant, via calls such as those that follow: import java.awt.event.ActionEvent; import javax.swing.*; import static javax.swing.KeyStroke.getKeyStroke; public abstract class KeyBoundButton extends JButton{ public abstract void action(ActionEvent e); public KeyBoundButton(String actionMapKey, int key, int mask) { Action myAction = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { action(e); } }; setAction

change CAPSLOCK to Ctrl Archlinux command line

余生长醉 提交于 2019-12-13 14:44:25
问题 I have Tmux setup on my iMac so that CAPS and Ctrl are swapped and C-a is the prefix. On my old laptop I have archlinux without Xwindows and I can't figure out how to remap those keys. On Mac it was straightforward. How do I do it on my barebones linux setup? 回答1: Create a file ctrl-caps-swap.map : keymaps 0-127 keycode 29 = Caps_Lock keycode 58 = Control And load it under root as loadkeys ./ctrl-caps-swap.map . You can read more about custom key mappings on Arch wiki. 来源: https:/

Javascript multiple keys depressed

好久不见. 提交于 2019-12-13 13:05:00
问题 so right now I'm using a function that will set a value to true if one key being pressed, another being pressed regardless of whether or not the first one is still depressed. function doc_keyUp1(e) { if (e.keyCode == 37){ lPunch = true } } function doc_keyUp2(e) { if (e.keyCode == 39){ rPunch = true } } document.addEventListener('keyup', doc_keyUp1, false) document.addEventListener('keyup', doc_keyUp2, false) The thing is, I want to be able to have it make sure that if the second key is being

wxPython Key Bindings don't work on Linux

拈花ヽ惹草 提交于 2019-12-13 07:57:08
问题 The following program works for me in Windows but not in Linux. There are no print statements displayed when I press the keys that I binded. However, the tab key can switch between the two buttons and the enter and space key toggle them. No other keys work. import wx class MyForm(wx.Frame): def __init__(self): wx.Frame.__init__(self, None, wx.ID_ANY, "Pressing dem keyz") # Add a panel so it looks the correct on all platforms panel = wx.Panel(self, wx.ID_ANY) self.btn = wx.ToggleButton(panel,