key-bindings

Key bindings with multiple keys

假装没事ソ 提交于 2019-12-23 02:20:28
问题 I'm using this code to bind keyboard keys to custom actions without using the KeyListener : Action left = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.out.println("pressed left key"); } }; Action right = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.out.println("pressed right key"); } }; Action space = new AbstractAction() { @Override public void actionPerformed(ActionEvent e) { System.out.println("pressed space

Pygame, get key object from character

依然范特西╮ 提交于 2019-12-23 01:46:07
问题 I'm making a multiplayer platformer/shooter/brawl game with pygame and I'd like for the players to easily change their keybinds (such as from a config file). I haven't been able to find a way to read a character string and use that as a transition to the pygame.K_xx objects as of now so I ask the community. Any leads ? 回答1: With the constants of this list you can use getattr(pygame, 'K_'+ mychar) to access a constant by name. 来源: https://stackoverflow.com/questions/46714719/pygame-get-key

Detect a key being held down in java 7

↘锁芯ラ 提交于 2019-12-22 18:42:27
问题 I'm trying to key bind the a and d keys to make a character move left and right, but the actions only happen once when you press the keys. How can I modify this code to make it do the event while a or d is being held down? p.getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_W, 0),"up"); p.getActionMap().put("up", new UpAction()); p.getInputMap(JPanel.WHEN_IN_FOCUSED_WINDOW).put(KeyStroke.getKeyStroke(KeyEvent.VK_A, 0), "left"); p.getActionMap().put("left", new

Tkinter keybinding for Control-Shift-Tab

点点圈 提交于 2019-12-22 12:37:47
问题 What's the key-binding for Control-Shift-Tab? I've tried lots of things and nothing seems to work. I'm already aware of tkinter.ttk.Notebook.enable_traversal. If you know of a handler for tabs being activated, that would suffice, too. 回答1: The general format for representing an event is: <[event modifier(s)-]...event type [-event detail]>. For key-binding Ctrl+Shift+Tab the format would be: 'Control-Shift-KeyPress-Tab'. In this case the event modifiers would be: Control- Shift-, the event

PhpStorm Unknown keyCode: 0x0

╄→гoц情女王★ 提交于 2019-12-22 07:59:27
问题 When I trying to use default keymaps like Ctrl-C, Ctrl-V, etc. they not working. When I trying to map custom keymap, I get error by pressing on character keys: Unknown keyCode: 0x0 What it can be? I tried to install Java 1.6, 1.7, same thing. PS: Using Fedora 19 EDIT My default lang is English. But playing with keyboard settings of XFCE made it work oO. Issue with keyboard layouts.. Thanks 回答1: What's your primary keyboard layout. Make sure it's English and not Russian. Try adding -Dide.non

PhpStorm Unknown keyCode: 0x0

半世苍凉 提交于 2019-12-22 07:59:18
问题 When I trying to use default keymaps like Ctrl-C, Ctrl-V, etc. they not working. When I trying to map custom keymap, I get error by pressing on character keys: Unknown keyCode: 0x0 What it can be? I tried to install Java 1.6, 1.7, same thing. PS: Using Fedora 19 EDIT My default lang is English. But playing with keyboard settings of XFCE made it work oO. Issue with keyboard layouts.. Thanks 回答1: What's your primary keyboard layout. Make sure it's English and not Russian. Try adding -Dide.non

Gnome Shell Extension Key Binding

假如想象 提交于 2019-12-22 05:26:20
问题 What is the simplest way to (globally) bind a key combination (e.g. <Super>+A ) to a function in a gnome shell extension? Inspecting a couple of extensions, I ran into the following code: global.display.add_keybinding('random-name', new Gio.Settings({schema: 'org.gnome.shell.keybindings'}), Meta.KeyBindingFlags.NONE, function() { /* ... some code */ }); I understand that the key combination is specified by the schema parameter, and that it's possible to create an XML file describing the

KeyPress: How to detect if the user pressed the “Down” arrow key on their keyboard when the app is running

谁说胖子不能爱 提交于 2019-12-21 02:51:37
问题 Here is what I've got so far.. I'm using this as a keybind. I want to press the "Down" arrow key anytime the app is running, and then make it auto press the "Down" arrow key 3 extra times then finish by pressing "Enter" in the code. I know this isn't the best explanation but sorry and I will try to explain it any better if you still didnt understand. Here is the code: public class MyKeyListener extends KeyAdapter{ @Override public void keyPressed(KeyEvent evt){ } KeyListener keyListener = new

Stop Alt key bringing up the menu in Sublime Text 2

佐手、 提交于 2019-12-20 16:20:42
问题 I'm an Emacs user looking into Sublime Text 2. I've remapped the default Emacs key bindings and have become accustomed to moving about using Alt+i, Alt+k, Alt+j, Alt+l for up, down, left and right. I haven't had any issues remapping those keys in Sublime Text. The problem is that whenever I use these keys to navigate the menu pops up even though I've hidden it in distraction free mode. I would like to stop the menu coming up when I press the Alt key. If possible I would like to remap the key

Multiple-line cursor movements in XCode 4

你说的曾经没有我的故事 提交于 2019-12-20 10:55:12
问题 The same question has been asked for Xcode 3 But the solution there is said to not work with Xcode4. And no new solution is available there. How to get a key-binding to move the curser up/down about 10 lines in Xcode 4 ? 回答1: Eureka! Inspired by the answer on line duplication, this is how you empower Xcode 4 with multiple-line movement: Go to the folder /Applications/Xcode.app/Contents/Frameworks/IDEKit.framework/Versions/A/Resources Open IDETextKeyBindingSet.plist . Add a new dictionary