반응형
windows -- console 키보드 입출력
참조 : https://docs.python.org/2/library/msvcrt.html
import msvcrt
import time
while 1:
if msvcrt.kbhit():
c = msvcrt.getwch()
if c == u'\x1b': # ESC key -> exit
print '\n -- exit ---\n'
time.sleep(1)
break
if c == u'\00' or c == u'\xe0': # function key
msvcrt.getwch() # skip function keycode
else :
msvcrt.putwch(c)
반응형
'python' 카테고리의 다른 글
| 장고처럼 instance 생성시 class 변수에 값 설정하기. (0) | 2014.07.29 |
|---|---|
| terminal (interactive) 입력여부인지 확인하기.. (0) | 2014.07.21 |
| windows 7 64bit 에서 pyPdf 모듈 설치하기 (0) | 2014.07.20 |
| python - clipboard 로 text, image 복사하기 , 가져오기 (1) | 2014.07.11 |
| matplotlib tutorial 정리 (0) | 2014.07.01 |


