Show More
@@ -15,8 +15,13 b' Inputhook management for GUI event loop integration.' | |||
|
15 | 15 | #----------------------------------------------------------------------------- |
|
16 | 16 | |
|
17 | 17 | import ctypes |
|
18 | import os | |
|
18 | 19 | import sys |
|
19 | 20 | import warnings |
|
21 | if os.name == 'posix': | |
|
22 | import select | |
|
23 | elif sys.platform == 'win32': | |
|
24 | import msvcrt | |
|
20 | 25 | |
|
21 | 26 | #----------------------------------------------------------------------------- |
|
22 | 27 | # Constants |
@@ -33,9 +38,19 b" GUI_GLUT = 'glut'" | |||
|
33 | 38 | GUI_PYGLET = 'pyglet' |
|
34 | 39 | |
|
35 | 40 | #----------------------------------------------------------------------------- |
|
36 |
# Utilit |
|
|
41 | # Utilities | |
|
37 | 42 | #----------------------------------------------------------------------------- |
|
38 | 43 | |
|
44 | def stdin_ready(): | |
|
45 | if os.name == 'posix': | |
|
46 | infds, outfds, erfds = select.select([sys.stdin],[],[],0) | |
|
47 | if infds: | |
|
48 | return True | |
|
49 | else: | |
|
50 | return False | |
|
51 | elif sys.platform == 'win32': | |
|
52 | return msvcrt.kbhit() | |
|
53 | ||
|
39 | 54 | |
|
40 | 55 | #----------------------------------------------------------------------------- |
|
41 | 56 | # Main InputHookManager class |
@@ -24,26 +24,13 b' import time' | |||
|
24 | 24 | from timeit import default_timer as clock |
|
25 | 25 | import wx |
|
26 | 26 | |
|
27 | if os.name == 'posix': | |
|
28 | import select | |
|
29 | elif sys.platform == 'win32': | |
|
30 | import msvcrt | |
|
27 | from IPython.lib.inputhook import stdin_ready | |
|
28 | ||
|
31 | 29 | |
|
32 | 30 | #----------------------------------------------------------------------------- |
|
33 | 31 | # Code |
|
34 | 32 | #----------------------------------------------------------------------------- |
|
35 | 33 | |
|
36 | def stdin_ready(): | |
|
37 | if os.name == 'posix': | |
|
38 | infds, outfds, erfds = select.select([sys.stdin],[],[],0) | |
|
39 | if infds: | |
|
40 | return True | |
|
41 | else: | |
|
42 | return False | |
|
43 | elif sys.platform == 'win32': | |
|
44 | return msvcrt.kbhit() | |
|
45 | ||
|
46 | ||
|
47 | 34 | def inputhook_wx1(): |
|
48 | 35 | """Run the wx event loop by processing pending events only. |
|
49 | 36 |
General Comments 0
You need to be logged in to leave comments.
Login now