python Newbie Question: key-press capturing. 
Author Message
 python Newbie Question: key-press capturing.

Hi,
I just started with programming in python. I used to work with
Qbasic.I already made some little functions in python but I can't fix
this problem with keyboard capturing.

I want to make a simple sequenser function that prints "pulse" and
stops when a key (forexample "q") is pressed.

I tried to use the functions "raw_input" and "sys.stdin.read()" but
they somehow it blocks out the rest of the code, the print "pulse"
line doesn't work anymore.

#------------------------------------------------------
key=""
x=0

while 1:
 key = raw_input()
 x =x+1
 if x > 100000:
     print "pulse"
     x=0
 if key == "q":
     break
print "q pressed"
#------------------------------------------------------

Thanks 4 your attention.

M. Theunissen



Fri, 08 Apr 2005 22:07:51 GMT  
 python Newbie Question: key-press capturing.
http://py-howto.sourceforge.net/curses/curses.html
the subsection 5 contains what you ask for

--
bromden
GCS d- s+: a- C++$ UL(++++) P-- L++ E--- W+(++) N++ o? K? w(++) !O M--
!V PS+ PE++ Y+ PGP+ t--- 5? X- R- tv-- b++>+++ DI- D- G e+++ h-- r- y?



Fri, 08 Apr 2005 23:18:07 GMT  
 
 [ 2 post ] 

 Relevant Pages 

1. How to capture key-presses (keyboard-presses)???

2. Newbie Question: Press any key to continue

3. Capturing key presses...

4. using python to press keys

5. Python - get key pressing ?

6. Another key capture question

7. newbie asks how to capture embeded python output

8. C4 Newbie Question - Using Functions Keys

9. newbie question: extended key

10. python parsing question from a python newbie (though coding for 10 years)

11. IBM VA close window upon key pressed event

12. Tracking key presses, mouse clicks and mouse movements?

 

 
Powered by phpBB® Forum Software