Commits

anatoly techtonik committed 284c4f3

flush buffer after all, add [w] and [s] commands

  • Participants
  • Parent commits 3578d9f

Comments (0)

Files changed (1)

File asyncinput.py

 eventread = ctypes.wintypes.DWORD()
 inbuf = (INPUT_RECORD * 1)()
 
-print "[q]uit, [s]top keyboard processing, launch bro[w]ser"
+print "[q]uit, [s]top console processing, launch bro[w]ser"
 stopflag = False
 while not stopflag and nph in handles:
     print "Waiting for handles %s.." % handles
             if char == 'q':
               print('[q] key pressed. Exiting..')
               stopflag = True
+            elif char == 's':
+              handles.remove(ch)
+            elif char == 'w':
+              import webbrowser
+              webbrowser.open('http://techtonik.rainforce.org')
             #print char
         # --- /processing input --------------------------
 
     else:
         print("Warning: Unknown return value '%s'" % ret)
 
+ctypes.windll.kernel32.FlushConsoleInputBuffer(ch)
 ctypes.windll.kernel32.CloseHandle(nph)
 print "Done."