python script reading special keys like <F1>, <F2> etc.
I am planning to write a very simple python script that displays files
based on user input. E.g. I need to display f1.msg file if the user
presses <F1> key, f2.msg file if the user presses <F2> key. What is the
easiest way to do this on Linux (xterm/vt100/asni etc). I tried using
curses and it works, but I want something that does NOT modify or redraw
the user screen.
Something like this:
def display():
key = raw_input()
if key == <F1>
sys.stdout.write(open(f1.msg, "r").read())
elif key == <F2>
sys.stdout.write(open(f2.msg, "r").read())
else: # I need to capture his input string too.
return key
I can make a restriction that the user press <Enter> after typing the
above keys if required. Is there a solution that doesn't redraw the
screen like curses does and kind of portable at the same time to
different terminals on Linux/Unix?
.
Relevant Pages
- Re: Is threading the right solution for this challenge?
... A typical screen "refresh" could take up to 10-15 ... the display thread (since it is only inquiring there is no danger ... interrupt itself to check for user input and react to it. ... In ACCEPT with TIMEOUT, what happens if the user was in the process of ... (comp.lang.cobol) - Re: best way to tackle issue with writing Data, Appending Data and Rea
... data that I have read from my database and the two are related. ... would help me in my display of data in a grid. ... Read user input and store user input and DataRow to a file. ... display user input and data row in a DataGrid. ... (microsoft.public.dotnet.framework.adonet) - Is threading the right solution for this challenge?
... Compiler: MF SE 4.2 SP2 ... Have a continually refreshing display screen that also ... responds to user input. ... (comp.lang.cobol) - Re: Displaying forms
... Form1 is displayed and at some point, based on user input,I want to hide Form 1, switch to Form 2, display it and run the only procedure contained in it then unload it and return to Form 1 and make it visible and continue processing. ... There is no user input on Form2, only a label with fixed data. ... (microsoft.public.vb.general.discussion) - Re: Best practice for inserting new DataRows with lots of not nul
... The not null-constraint enforces a user input. ... >> Don't add the row to the member table until the user hits the save button. ... > proper input, it must be added to the table beforehand, because all the ... > textboxes (used for display and editing) are bound to that DataTable. ... (microsoft.public.dotnet.framework.adonet) |
|