Questions tagged [keyboard-input]

101 questions
0
votes
1 answer

How to count how many times a user presses a key in a given time

I'm trying to count the number of times a person presses a button a certain number of times. import turtle if random.randint(1,2) == 2: turtle.listen() turtle.onkey(number() ,'s') else: pass def number(): global shots …
Jaws3D
  • 27
  • 3
0
votes
1 answer

How can `sdl2.SDL_GetKeyboardState` be used correctly?

I'm attempting to use the python library pysdl2 to construct an emulator. The library has been working well so far, however I've been having problems receiving keyboard input. What I essentially needed to do is test if certain keys are pressed.…
Christian Dean
  • 19,561
  • 6
  • 42
  • 71
0
votes
0 answers

How to Read Keyboard Input in Windows Service

I have problem when trying to read keyboard input using windows service. In Windows Form it can be done easily by using global keyboard hook and read eventargs. But in windows service how do I set so my service can detect event when I press key in…
0
votes
1 answer

Input superclass variables in Python

I'm building a web crawler with Python. I created a parent class to save the user and the password, that I'd like to be inputed via keyboard. The parent class looks like this: class ParentCrawler(object): def __init__(self): """Saves the user…
Xoel
  • 121
  • 2
  • 8
0
votes
1 answer

How intercept these two key: ":" and "."?

I need to do something when a user push "." and something else when an user push ":" Is there a way to intercept these 2 key with javascript, jQuery or other ?
xRobot
  • 22,700
  • 56
  • 163
  • 281
0
votes
1 answer

Keyboard input in C# and WPF not working

I am developing a small game where there are ellipses as targets and textblock over those ellipses displaying an Alphabet(changes every 3 sec). I want to implement a functionality where a user presses an alphabet on keyboard and if that matches with…
sketch_TF2
  • 51
  • 9
0
votes
1 answer

How do I use the Key class in Silverlight

I found the Key class for determining key input in a textbox but it seems to be just for wpf. How do I use it in Silverlight? https://msdn.microsoft.com/en-us/library/aa274297(v=vs.60).aspx
xarzu
  • 7,579
  • 35
  • 100
  • 140
0
votes
1 answer

Give Error and Exit when no Keyboard Input is Provided

A rookie here! This is a very simple one. I am trying to write a script that asks for user inputs. Then read the inputs and do some stuff with it. But I first want to make sure inputs are provided. Example: echo "Please provide input1:" read…
SSF
  • 759
  • 2
  • 16
  • 36
0
votes
2 answers

Keyboard input doesn't work, works when clicking the mouse

I have this code: #include #include using namespace std; bool* Keys = new bool[256]; void keyboardDown(unsigned char key, int x, int y) { Keys[key] = true; } void keyboardUp(unsigned char key, int x, int y) { …
0
votes
1 answer

keyboard input from separate classes for movement

I was wondering how you get keyboard input from a separate class in as3. I have a class that will use the arrow keys to move but it needs to be in the hero class how do i call the movement function from the main function?
0
votes
1 answer

No keyboard input AS3

So I'm trying to get keyboard input from the user to move a character. It works in another program that I was using, and I copy pasted, but it isn't working in this one. It gives me Line 87, Column 38 1119: Access of possibly undefined property…
kevorski
  • 721
  • 1
  • 7
  • 26
0
votes
0 answers

How to find which keyboard key has been pressed using GetAsyncKeyState()?

I am currently having trouble correctly retrieving some of the keys on a standard keyboard (specifically F keys, arrow keys etc). I am cycling through all 256 ASCII characters using GetAsyncKeyState() on each integer to see if it is pressed, and if…
0
votes
3 answers

Fill in an array from a single formatted keyboard line in C

How can I fill in a double or int array from a single, arbitrarily long, formatted (e.g. space delimited) keyboard line? For instance: Enter the elements of the array: 2 32 12.2 4 5 ... should result in => array[0] = 2 => array[1] = 32 etc. I…
hko
  • 129
  • 2
  • 10
0
votes
3 answers

How to call multiple functions in an if() statements in c#

So I need a c# if() statement which should look something like this, maybe? Code: ... if(CurrentGameState != gameState.gameLoading && gameState.mainMenu && keyboardState.IsKeyDown(Keys.Escape)) { CurrentGameState = gameState.mainmenu; } //I…
PowerUser
  • 740
  • 1
  • 10
  • 31
0
votes
1 answer

Detect keyboard input after windows recognition of the key

I am building a program that would print out the pressed buttons' values on the screen. I need it to work also when the program's window is not active. I tried using GetAsyncKeyState(int), which works fine. However, I can attach certain strings to…
Jonas Hoffmann
  • 315
  • 7
  • 18