473,320 Members | 1,856 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,320 software developers and data experts.

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 <F1key, f2.msg file if the user presses <F2key. 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 <Enterafter 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?
Jul 18 '06 #1
0 1100

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: Paul Scotchford | last post by:
Env : SLQSERVER2000 - DTS I want to import a text file with 3 fields in it ... F1: Ident char(3) F2: Note (Text) char(32,000) yeah big eh! F3: Date Field F2: has...
3
by: otto | last post by:
i need to read a variable in a javascript and translate it to a form in html the javascript variable is: <SCRIPT LANGUAGE='JavaScript'>RF2N('Total');</script> and i need to put that...
3
by: Rakesh Sinha | last post by:
This is about the vector template defined in standard C++ . Suppose I want to create a *huge* vector , as follows. void f1() { vector < int > data(1024); //may be not very huge, but for...
7
by: James Johnson | last post by:
Are there structs in JavaScript? If not, what's the closest thing, or do I just use parallel arrays? I'm populating a JavaScript array from ColdFusion query, but I don't think I can do this: ...
37
by: Steven Bethard | last post by:
The PEP below should be mostly self explanatory. I'll try to keep the most updated versions available at: http://ucsu.colorado.edu/~bethard/py/pep_create_statement.txt...
8
by: someone | last post by:
I'm making an program that encodes text, and then writes it into another text file. The problem is that I can't seem to get the "file exists" checking right. If I use the command (coder is the...
7
by: John Nagle | last post by:
I've been parsing existing HTML with BeautifulSoup, and occasionally hit content which has something like "Design & Advertising", that is, an "&" instead of an "&amp;". Is there some way I can get...
36
by: kwitters | last post by:
I don't know if this is the right place to discuss the death of <in Python 3.0, or if there have been any meaningful discussions posted before (hard to search google with '<>' keyword), but why...
9
Catalyst159
by: Catalyst159 | last post by:
I have a form which is used to calculate residential Floor Area Ratio (FAR). The form is structured into seven parts as follows: Part A: Maximum FAR and Floor Area: Part B: Gross Floor Area of...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
0
by: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
0
by: ArrayDB | last post by:
The error message I've encountered is; ERROR:root:Error generating model response: exception: access violation writing 0x0000000000005140, which seems to be indicative of an access violation...
0
by: CloudSolutions | last post by:
Introduction: For many beginners and individual users, requiring a credit card and email registration may pose a barrier when starting to use cloud servers. However, some cloud server providers now...
0
by: Defcon1945 | last post by:
I'm trying to learn Python using Pycharm but import shutil doesn't work
0
by: af34tf | last post by:
Hi Guys, I have a domain whose name is BytesLimited.com, and I want to sell it. Does anyone know about platforms that allow me to list my domain in auction for free. Thank you

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.