The raw input API provides a stable and robust way for applications to accept raw input from any HID (Human Interface Devices), including the keyboard and mouse.
Questions tagged [raw-input]
623 questions
12
votes
4 answers
Reading input from raw_input() without having the prompt overwritten by other threads in Python
I'm trying to let the user input commands at a console using raw_input(), this works fine. The problem is I have background threads that occasionally output log-information to the screen and when they do they mess up the input prompt (since the…

Jim
- 123
- 1
- 1
- 6
12
votes
2 answers
Type text without displaying text
I need something like raw_input, but without displaying the text you are typing.
Also I tried getpass, but it still displays what I just typed.

user2349129
- 123
- 1
- 6
12
votes
3 answers
How to go back to first if statement if no choices are valid
How can I have Python move to the top of an if statement if no condition is satisfied correctly.
I have a basic if/else statement like this:
print "pick a number, 1 or 2"
a = int(raw_input("> ")
if a == 1:
print "this"
if a == 2:
print…

wondergoat77
- 1,765
- 9
- 32
- 60
10
votes
4 answers
using map(int, raw_input().split())
Though I like python very much, When I need to get multiple integer inputs in the same line, I prefer C/C++. If I use python, I use:
a = map(int, raw_input().split())
Is this the only way or is there any pythonic way to do it? And does this cost…

Aswin Murugesh
- 10,831
- 10
- 40
- 69
8
votes
2 answers
Python raw_input ignore newline
Is there a way to ignore newline characters in data entered through raw_input? I am trying to use raw_input to input a list of strings that are copied and pasted from a spreadsheet. the problem is that it appears that the new line characters cause…

user1175490
- 81
- 1
- 1
- 2
8
votes
3 answers
Tab Completion in Python Command Line Interface - how to catch Tab events
I'm writing a little CLI in Python (as an extension to Mercurial) and would like to support tab-completion. Specifically, I would like catch tabs in the prompt and show a list of matching options (just like bash).
Example: Enter section name:
…

Paulitex
- 453
- 6
- 9
7
votes
2 answers
Asyncore loop and raw_input problem
I'm trying to learn asyncore module. So I decided to develop a chat program. I have to listen the network and broadcast udp packages same time. But problem is while user typing a message, user cannot see other messages that sent by another users.…

voiceofthesoul
- 95
- 1
- 8
7
votes
6 answers
Python: Problem with raw_input reading a number
unfortunately raw_input is not doing what I need it to do. What I am trying to do is get totPrimes = whatever I type in at the prompt. If i replace while count < totPrimes with while count < 50 this script works. If I type 50 into the prompt, this…

yoshyosh
- 13,956
- 14
- 38
- 46
7
votes
1 answer
raw_input() and sys.stdin misbehaves on CTRL-C
I am trying to detect a KeyboardInterrupt exception when CTRL-C is pressed during a raw_input() prompt. Normally the following code works just fine to detect the command:
try:
input = raw_input("Input something: ")
except KeyboardInterrupt:
…

crdavis
- 21,005
- 3
- 14
- 9
7
votes
2 answers
Using wxPython to get input from user
Suppose I need to replace the raw_input function in the following code with a wxPython dialog box that asks for user input and returns the value to program:
...
x = raw_input("What's your name?")
print 'Your name was', x
...
I'm just looking for a…

AXO
- 8,198
- 6
- 62
- 63
6
votes
1 answer
GetKeyNameText numpad missing text
I'm trying to get the name of a pressed key with GetKeyNameText, using the make/scan code and extended-key flag given by raw input:
std::wstring GetKeyName(const RAWKEYBOARD& info)
{
WCHAR n[128];
const int l = GetKeyNameTextW((info.MakeCode…

Bizzarrus
- 1,194
- 6
- 10
6
votes
4 answers
How to let a raw_input repeat until I want to quit?
Say I want to use raw_input like this:
code = raw_input("Please enter your three-letter code or a blank line to quit: ")
under:
if __name__=="__main__":
How can I let it repeat multiple times rather than just once every time I run the…

timy
- 3,663
- 4
- 18
- 8
6
votes
3 answers
Low level keyboard hook & keystrokes from rawinput
Currently, I'm making a program that intercept keystrokes from a specific keyboard (filtered using its HID). So to know which keystrokes have been sent by a specific device, I used the RawInput technic, inspired by this great…

Louisbob
- 860
- 3
- 9
- 22
6
votes
1 answer
How to simulate raw input / Send a WM_INPUT message to an application the right way?
i am trying to send a WM_INPUT-message to an application, but i encounter a few hurdles which i fail to solve.
I've created the RAWINPUT-structure like the following:
//try sending 'W'
RAWINPUT raw = {0};
char c = 'W';
//header
…

Juarrow
- 2,232
- 5
- 42
- 61
5
votes
1 answer
Multiple Raw Input Window Sinks
I have a message-only window (ATL::CWindowImpl) that registers itself for raw input using the RIDEV_INPUTSINK flag, meaning it gets all input regardless of whether the window is the foreground window. This works great when there's only one instance…

RaptorFactor
- 2,810
- 1
- 29
- 36