##// END OF EJS Templates
inputhook: improve stdin_ready()...
Christian Boos -
Show More
@@ -18,10 +18,6 b' import ctypes'
18 import os
18 import os
19 import sys
19 import sys
20 import warnings
20 import warnings
21 if os.name == 'posix':
22 import select
23 elif sys.platform == 'win32':
24 import msvcrt
25
21
26 #-----------------------------------------------------------------------------
22 #-----------------------------------------------------------------------------
27 # Constants
23 # Constants
@@ -43,13 +39,16 b" GUI_PYGLET = 'pyglet'"
43
39
44 def stdin_ready():
40 def stdin_ready():
45 if os.name == 'posix':
41 if os.name == 'posix':
42 import select
46 infds, outfds, erfds = select.select([sys.stdin],[],[],0)
43 infds, outfds, erfds = select.select([sys.stdin],[],[],0)
47 if infds:
44 if infds:
48 return True
45 return True
49 else:
46 else:
50 return False
47 return False
51 elif sys.platform == 'win32':
48 elif os.name == 'nt':
49 import msvcrt
52 return msvcrt.kbhit()
50 return msvcrt.kbhit()
51 return True # assume there's something so that we won't wait forever
53
52
54
53
55 #-----------------------------------------------------------------------------
54 #-----------------------------------------------------------------------------
General Comments 0
You need to be logged in to leave comments. Login now