473,385 Members | 1,409 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,385 software developers and data experts.

Re: How can I handle the char immediately after its input,without waiting an endline?

Lave,

If you're doing this btw, you may want to look at
the curses module or urwid (3rd-party).

cheers
James

On Wed, Oct 22, 2008 at 9:17 PM, Lave <la*********@gmail.comwrote:
Yes, it's what i want. Many thanks.

BTW,python-list 's reply is so quick. I love it. I like you all guys.

On 10/22/08, rishi pathak <ma*************@gmail.comwrote:
>The below piece of code should give you some understanding

import tty
import sys
tty.setraw(sys.stdin.fileno())
char=''
print "Press x to exit"
while char != 'x' :
char = sys.stdin.read(1)
print "You entered : ",char
# Your code here
On Wed, Oct 22, 2008 at 2:34 PM, Lave <la*********@gmail.comwrote:
>>Hi, all.

I'm a new comer. So This question maybe sutpid.:)

I want to write something that handle every char immediately after its
input. Then tehe user don't need to type [RETURN] each time. How can I
do this?

Thanks in advance.
--
Regards

Lave
--
http://mail.python.org/mailman/listinfo/python-list

--
Regards--
Rishi Pathak
Pune-Maharastra


--
Regards

Lave
--
http://mail.python.org/mailman/listinfo/python-list


--
--
-- "Problems are solved by method"
Oct 22 '08 #1
1 1498
Is there a way to do the opposite of tty.setraw afterwards to prevent
the terminal from not displaying any characters that are typed in? Of
course, this can be resolved by re-opening it, but thats not really
convenient.
Oct 22 '08 #2

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

Similar topics

4
by: jagmeena | last post by:
Hello, I am sure this problem has been addressed before, however, I could'nt get a suitable solution to my problem. Hence I am posting here. Thanks a lot for all your help. The code I have is ...
9
by: Sathyaish | last post by:
I noticed that gets() reads into the buffer even if the you've not allocated enough memory. For instance, if you do: char *str=(char*)malloc(sizeof(char)); printf("Enter something about...
6
by: Leandro Berti via DotNetMonster.com | last post by:
Hi All, I wrote a code to do serial communication with an equipament. When i use the code outside of threaded class it seens work properly, but when i put inside a class and execute a thread in...
19
by: rich | last post by:
I am building an app using php and postgresql. My questionis this. How do you handle people wanting to make parallel changes to a record. Since in web apps you are doing a select, bring over a...
5
by: Jonah Bishop | last post by:
I'm developing a photo album web application for use on a web site, and I'm running into a problem with lengthy operations. My application allows the user to import a number of images at once into...
20
by: gert | last post by:
This based on a example i found at http://www.cs.tut.fi/~jkorpela/ forms/cgic.html #include <fcgi_stdio.h> #include <stdlib.h> int urldecode(char *src, char *last, char *dest){ int code;...
0
by: wmihelpme | last post by:
Hi All, I have written a WMI Program which changes the network settings like ip address, subnet mask, gateway and dns addresses for given adapter number. when I call that function for adapter...
0
by: Lave | last post by:
Hi, all. I'm a new comer. So This question maybe sutpid.:) I want to write something that handle every char immediately after its input. Then tehe user don't need to type each time. How can I...
0
by: Lave | last post by:
Yes, it's what i want. Many thanks. BTW,python-list 's reply is so quick. I love it. I like you all guys. On 10/22/08, rishi pathak <mailmaverick666@gmail.comwrote: -- Regards
0
by: Terry Reedy | last post by:
rishi pathak wrote: Does not work on Windows, at least with 3.0, as tty fails trying to import termios. There, use msvcrt module "msvcrt.kbhit() Return true if a keypress is waiting to be...
0
by: Faith0G | last post by:
I am starting a new it consulting business and it's been a while since I setup a new website. Is wordpress still the best web based software for hosting a 5 page website? The webpages will be...
0
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 3 Apr 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome former...
0
by: ryjfgjl | last post by:
In our work, we often need to import Excel data into databases (such as MySQL, SQL Server, Oracle) for data analysis and processing. Usually, we use database tools like Navicat or the Excel import...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...

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.