raw-input

WX Python and Raw Input on Windows (WM_INPUT)

Does anyone know how to use the Raw Input facility on Windows from a WX Python application? What I need to do is be able to differentiate the input from multiple keyboards. So if there is another way to achieving that, that would work too. ...

Raw_input in Python

if i do : string = raw_input('Enter the value') it will come on shell. Can i collect the value I entered in variable string ??? How to use that entered value in my program like : if dict.has_key('string'): print dict[string] ??? ...

python exit a blocking thread?

in my code i loop though raw_input() to see if the user has requested to quit. My app can quit before the user quits, but my problem is the app is still alive until i enter a key to return from the blocking function raw_input(). Can i do to force raw_input() to return? by maybe sending it fake input? could i terminate the thread its on? ...

EOFError in Python script

I have the following code fragment: def database(self): databasename="" host="" user="" password="" try: self.fp=file("detailing.dat","rb") except IOError: self.fp=file("detailing.dat","wb") pickle.dump([databasename,host,user,password],self.fp,-1) self.fp.close() selffp=f...

how to let a raw_input repeat until I wanna quit?

Say I 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 program? Another question is to write what code can satisfy the condition "or a blank line to quit (the program)"...

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: ext*TAB* extensions extras The problem is I'm not sure how to catch the Tab ev...

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 output go wherever the cursor happens to be at the moment). This is a small Python program th...

Python: Appending to a text file

Possible Duplicates: Confused with appending to text file How can I write to the textfile with while? text_file = open("write_it.txt", "a") while 1: word = raw_input("Please add to a text file: ") if not word: break text_file.write(word) text_file.close() This code adds to the text file without spaces,...

Is there a function in C that does the same as raw_input in Python?

Is there a C function that does the same as raw_input in Python? #in Python:: x = raw_input("Message Here:") How can I write something like that in C? Update:: I make this, but i get an error :: #include<stdio.h> #include<string.h> #include "stdlib.h" typedef char * string; int raw_input(string msg); string s; string *d; main(){...

Calling/selecting variables (float valued) with user input in Python

I've been working on a computational physics project (plotting related rates of chemical reactants with respect to eachother to show oscillatory behavior) with a fair amount of success. However, one of my simulations involves more than two active oscillating agents (five, in fact) which would obviously be unsuitable for any single visual...

How do I get user input to refer to a variable in Python?

I would like to get user input to refer to some list in my code. I think it's called namespace? So, what would I have to do to this code for me to print whatever the user inputs, supposing they input 'list1' or 'list2'? list1 = ['cat', 'dog', 'juice'] list2 = ['skunk', 'bats', 'pogo stick'] x = raw_input('which list would you like me t...

How to simply read in input from stdin delimited by space or spaces

Hello I'm a trying to learn python, In C++ to read in string from stdin I simply do string str; while (cin>>str) do_something(str) but in python, I have to use line = raw_input() then x = line.split() then I have to loop through the list x to access each str to do_something(str) this seems like a lot of code just to get eac...

raw_input and timeout

I have thise huge code that I'm going to implement . Before I start that, I want to do a raw_input('Enter something: .'). I want it to sleep for 3 secs and if there's no input, then cancel the raw-input prompt and run the rest of the code. Then the code loops and implements the raw_input again. I want it so that if somedoes put a raw_i...

Python raw_input("") error

Hello, I am writing a simple commandline script that uses raw_input, but it doesn't seem to work. This code: print "Hello!" raw_input("") Produces this error: Traceback (most recent call last): File "<pyshell#6>", line 1, in <module> raw_input("") TypeError: 'str' object is not callable I have never encountered this error before,...

How to get raw mouse events with XI2 extension?

I'm using XISelectEvents for root window with deviceid=XIAllDevices and mask=XI_RawMotion, but I don't get any events. What's wrong? ...

How to emulate WM_KEYDOWN, WM_KEY* from a WM_INPUT handler registered with RIDEV_NOLEGACY?

I have a system with two HID keyboards (actually, one's a barcode scanner.) I registered for raw input with RIDEV_NOLEGACY to block the system from creating WM_KEY* messages for the barcode scanner, which tediously also blocks the messages from the other keyboard. My goal is to keep the WM_* messages for any keybaord device that isn't ...