470,614 Members | 1,458 Online
Bytes | Developer Community
New Post

Home Posts Topics Members FAQ

Post your question to a community of 470,614 developers. It's quick & easy.

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 1370
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 discussion thread is closed

Replies have been disabled for this discussion.

Similar topics

4 posts views Thread by jagmeena | last post: by
9 posts views Thread by Sathyaish | last post: by
6 posts views Thread by Leandro Berti via DotNetMonster.com | last post: by
5 posts views Thread by Jonah Bishop | last post: by
By using this site, you agree to our Privacy Policy and Terms of Use.