Questions tagged [keypress]
Occurs when a key is pressed while the control has focus.
2,621
questions
1
vote
0
answers
30
views
How can I make that the KeyPress event only activates once
I'm implementing in Java for making a battle menu in an RPG, and I found this problem that I can't manage to fix. When I press my <Z> key I use like an accept to enter the magic SubMenu, it ...
-1
votes
0
answers
26
views
Detecting if text is currently in console and reacting based off that condition in python?
I'm working on a simple script to essentially create an inventory list. The user, using a USB barcode scanner that would essentially just type the SKU data from the barcode into the console running ...
0
votes
2
answers
22
views
holding down attack key repeats animation frame, how to prevent this in godot?
I have this grab and knee attack code which is part of a bigger script. The problem is I want it so that the player when grabbing the enemy that, when performing a knee attack that the player should ...
0
votes
0
answers
23
views
F2 key press event on macOS
Why kVK_F2 is not equivalent to constant NSF2FunctionKey for F2 key press event, What is equivalent constant of kVK_F2, since carbon framework is deprecated.
When I printed the keyCode, The [Event ...
2
votes
1
answer
36
views
Detecting keypresses in Python
I'm trying to detect a keypress (for example Space) in Python. Everyone online is referring to the module 'Keyboard'. I've tried to use this, but it will not work. I did install the package and I'm ...
0
votes
1
answer
24
views
Excel VBA Detect A KeyPress Only When Cell In A Certain Range Is Selected
I have a spreadsheet and I would like to use KeyPress to detect if the user presses 1, 2, 3 or 4 keys. I have a range on my sheet that is 10 cells by 20 cells and I only want to KeyPress event to ...
0
votes
1
answer
13
views
Node.js process/readline on keypress listener prevents the app from ever ending on its own
I'm trying to:
write a simple awaitable async function for a TUI node.js app
that waits for a single key press on the keyboard (without having to press Enter after)
and returns info about the key ...
-1
votes
0
answers
25
views
KeyPressEvent does not work - PyQt6 on MacOS
I want to define KeyPressedEvent for key "B" using PyQt6 on MacOS.
def keyPressEvent(self, event: QKeyEvent):
print(event.key())
if event.key() == QtCore.Qt.Key.Key_B:
...
-2
votes
1
answer
47
views
VBA: define a variable with a keypress
I have a small VBA macro that runs in a loop over a minute or so, producing a dynamic Excel display. I want to change the display when a key is pressed, by defining a variable - for example if 'e' is ...
0
votes
1
answer
26
views
How do I exit a python script using a hotkey like ctrl+q?
I've only just picked up python and am trying to make scripts that can do menial labor but would like a custom hotkey to exit the code.
Please excuse any jank, I am new to coding and have just copied ...
-1
votes
1
answer
44
views
Element invisible on pressed enter key
This time... I'm trying to create a function where the element is supposed to show when the user would press the Enter Key. However, the keypress function does not work.
$(document).keypress(function(...
0
votes
0
answers
58
views
Add function keys to keybind
I am trying to change the keybind for a online virtual piano like this
self.virtualPianoScale = list("1!2@34$5%6^78*9(0qQwWeErtTyYuiIoOpPasSdDfgGhHjJklLzZxcCvVbBnm")
but I would like to ...
0
votes
3
answers
54
views
How to trigger keypress event with Class name using JavaScript
I am trying to trigger a keypress event when click left mouse button in an input tag with class name.
I can do with id but I don't know how to trigger with class name.
How can I solve this?
I wanna ...
1
vote
4
answers
43
views
Javascript, keypress if i use it when i want user input to be added in a list only one character i.e., the latest pressed key shows up
i wanted to add a userinput in a todo list using keypress but only one character is taken by the input filed.
this is the code:
input.addEventListener("keypress", function(event){
...
1
vote
0
answers
48
views
Custom combobox control ignores first tab key press
I have a very simple custom control based on the combobox control, that just adds the ability to provide a prompt for the user and adjust the color of the prompt text. It works well, except that if I ...
1
vote
1
answer
32
views
Toggle audio playback on keyboard key
Here is my code for 'click'- this works perfectly fine
masterPlay.addEventListener('click',() =>{
if (audioElement.paused || audioElement.currentTime<=0)
{
audioElement.play();
...
0
votes
0
answers
14
views
Simulate Actual Keypress For a Certain Amount of Time
I have a background timer which records the time when a key is pressed and a separate timer which records the duration. For example: I pressed a key 5 seconds after the timer started and held it for ...
0
votes
1
answer
80
views
Can automatic press backspace when scanning barcodes in the textbox on the vb.net
Can automatic press backspace when scanning barcodes in the textbox on the vb.net?
is there any other solution or my code is wrong?
Thanks
Private Sub txtUser_KeyPress(sender As Object, e As ...
1
vote
1
answer
44
views
Escape Eventlistener doesn't work but when i put enter in it, it works?
My Eventlistener for "Escape" doesn't work, but if I put in "Enter" instead of "Escape" it works with "Enter".
Here is my Code:
addEventListener("keypress", ...
0
votes
1
answer
115
views
How to detect specific keys on keyboard keypress?
How to detect letter 'A' keypress in swiftUI? macOS.
import SwiftUI
struct ContentView: View {
var body: some View {
VStack {
Rectangle()
.fill(.white)
...
0
votes
0
answers
31
views
how do i fix a laggy code? I just started learning how to use OpenCV in Python and I'm not sure how to get my live video feed to run smoothly
Hello stackoverflow community. I think you folks are prolly the only ones I can turn to for expert advice or help for apart from chatGPT(but that's not really reliable is it). I started learning how ...
0
votes
0
answers
21
views
Is there a way to get pynput to work on CodeHS's python 3 console
I have a program in Pycharm that uses pynput in order to detect when the user presses a key on their keyboard, giving different results depending on the key pressed. There are 2 threads: one ...
1
vote
0
answers
35
views
does there exist another option to detect a keypress instantaneously in python OpenCV program using cv2.waitKey, am i using it wrong in a while loop?
for an openCV program i was trying to build for a personal project, I needed to build a while loop that had 2 nested loops inside it which could be accessed by the keypress of the key m or the key a. ...
0
votes
1
answer
44
views
How to add autoprint function in an existing print dialog box
I am having a hard time figuring out the printing of ticket queue automatically since in my generated code, it only appears a new window and a print dialog box, I use MS Edge browser here. I want to ...
2
votes
0
answers
16
views
How to set ctrl button active (simulate that it is pressed) when page loads in javascript?
I have embedded a google map iframe into an html document. I want when the user rotates/scrolls mousewheel up or down over the iframe, it should zoom in and out on the map respectively. But here, a ...
0
votes
0
answers
28
views
Using MS Access 365. Key press event to update bound text field. Code only updates the field when execution is stopped
This Keypress event purpose is to update a bound field called txtSentto after searching a table of values. Code works when i stop execution with a stop command or debug tag. Allow code to run ...
0
votes
1
answer
31
views
changing attack types / states which are bound to same key input in godot
i have a player character that has 2 attack types, a single punch and a combo attack. i want it that when the player is not near any objects/ or enemy AI to play the single punch. and if the player ...
0
votes
0
answers
19
views
My Simon Game created on desktop is unable to work properly on a mobile phone
This Simon game code can only be played on desktop porperly because of keypress. When I try to change $(document).keypress(function () { to $(document).**click**(function () {, The game starts ...
0
votes
1
answer
200
views
How to trigger button press from ENTER Key in HTML
I'm making a Chatroom App and want the user to be able to type a message and hit enter when they send it. Currently it only sends when I press the "SEND" button with the mouse. How do I get ...
0
votes
1
answer
26
views
From OnKeyDown Call OnKeyPress
for some reason in my environment (CAD) Keypress is not called. So I need to call it manually from overridding KeyDown event. How to convert KeyDown information to a char to pass to KeyPress Event and ...
-1
votes
1
answer
31
views
Limit keydown execution only to specific div
I want to limit execution with hit enter only to specific div, not on whole page so that this enter key not impact to divs outside this #targer-wrapper but code below with checking div length didn't ...
0
votes
1
answer
59
views
My code works on its own, but when I put it into a class, it breaks
I have been making this alien game where you have to control the alien on a screen using "wasd", but when I put my code into a class, the class does not read Alien.KeyReleased in the set up, ...
1
vote
1
answer
31
views
How to prevent pageup/pagedown in Vuetify slider?
I'm using Vuetify 2.6 and have a v-slider. When that slider is moved by the user it obviously gets focus.
PageUp and PageDown is used for other functions and I want them to continue doing that even ...
1
vote
1
answer
128
views
Can one override accent keys behavior in javascript?
For certain foreign keyboards (German, Swedish) when one wants to write accented letters (á, ñ, ê) one would first press one of the accent keys (´, ~, ^) followed by the letter to have that accent. ...
0
votes
0
answers
56
views
pyautogui doesn't press keys on pc startup
I have been making a telegram bot that constantly runs on my computer. I made this project to run on pc startup using .bat file, so this bot starts working every time I turn on my PC and works until I ...
1
vote
2
answers
44
views
How to get a keypress to function the same as a click listener event in Javascript
I've made a simple little "game" where every time you click the picture of a balloon, it gets bigger until it "explodes" & then resets. Now I'm trying to get it to work the ...
0
votes
0
answers
65
views
Why my game don`t take input from my script
I have a problem with this script when I try to simulate I press key '1' from keyboard, script works properly in application like notepad/word but in game (Metin2 for example) doesn't work. Please ...
-3
votes
2
answers
176
views
Is it possible to have a key "Start" and then "Stop" a function?
I want to achieve the following:
I press and release the C key, and the letter C is typed, as normal.
But instead, I want to press and release the C key, and have ...
0
votes
1
answer
63
views
.NET WinForms KeyEventArgs.SuppressKeyPress: effect of setting it to True in the KeyUp event
The KeyEventArgs class in WinForms implements the Boolean SuppressKeyPress property. KeyEventArgs provides data for the KeyDown and KeyUp events. The SuppressKeyPress property can be set to True in a ...
0
votes
1
answer
29
views
Python script that runs in commandline detects keypress everywhere
currently im Working on a small project for myself and im detecting keypresses in my script but it also detects them while im typing for example in a game
if keyboard.is_pressed("q"):
...
0
votes
0
answers
65
views
pygame.key.get_pressed is not working correctly [duplicate]
I'm trying to get a rectangle to move on screen, but the keyboard presses aren't working, and I can't solve it. Can someone help?
import pygame
WIN = pygame.display.set_mode((900, 500))
pygame....
1
vote
1
answer
3k
views
UE5.1 Enhanced Input System: How can simultaneous key presses be handled properly for character movement?
I'm using the Enhanced Input system for an Unreal Engine 5.1.1 first person shooter project.
Unlike the recently depreciated old input system, holding down two opposite directional keys (e.g. ...
1
vote
2
answers
60
views
Pressing infinite number keys in python
so I wanted to create a code in python that automatically type numbers from 1 to 100
and it doesn't work. Hope someone can help
Here's my code
from pynput.keyboard import Key, Controller
import time
...
1
vote
0
answers
129
views
NodeJS: How to trigger the Pause/Play Media Key on Windows
I simply want to simulate/trigger the Pause/Play media key. Same thing as when you click on your wireless earbuds to pause/play music currently playing from any program/medium (such as YouTube).
I ...
-2
votes
1
answer
38
views
Is there a way to temporarily disable a Key press while an animation plays?
In my game you need to fix things by pressing X. When X is pressed an animation of the guy fixing is played, then the text changes for the number of things left to fix, then the broken thing's game ...
0
votes
2
answers
80
views
Is it possable to send keydown event and key up event?
is there a way to send a key down and key up event in Lua? Is it possible? (This is my first time asking a question here, I'm so nervous '~')
I want it to help you auto-press the key without you ...
0
votes
2
answers
166
views
Is there a way to detect a key press in a python Replit?
I am making a chat app in Replit through Python. I have a while true loop that checks if a message has been posted and will check if you pressed the T key, and if so, pauses the loop to let you type ...
0
votes
1
answer
73
views
how to press the key automatically in the game?
sorry in advance for my bad english.
I'm writing a game automation program , specifically the game requires a key press to start doing (something) , but when i use KeyBoard.press() function from ...
0
votes
2
answers
366
views
Detecting keypress is not working in javascript
I already looked up solutions, but not a single one could help me. I am coding a little snake game, but now I have to detect the user keypress. This is the code I wrote, can someone help me with that?
...
0
votes
1
answer
45
views
Works in the console but not in the .js file
i worked with addEventListner and it did work for the "click" propritie but not with "keypress" one,
so i tried the same code in the console and I had the result I was hoping for,...