Ask Your Question

msvcrt.hbhit() and msvcrt.getch() in Wing Pro 8 on Windows 10

asked 2022-05-05 21:24:24 -0600

daoming's avatar

updated 2022-05-06 05:29:45 -0600

Hi, I am using Wing Pro 8 on Windows 10. My Python scripts use mscvrt package for hbhit() and getch(). I can get input characters without them being printed on the screen. They work fine in Windows Command window be behave differently in Wing Pro 8. Here is a test script:

import msvcrt
import time
while True:
  while msvcrt.kbhit() == 0:
  print('getting ch')
  c = msvcrt.getch()
  print(f'input: {c}')
  if c==b'e':

When running in debug mode, msvcrt.kbhit() always returns zero and msvcrt.getch() never returns. Could it be fixed? Thank you.

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted

answered 2022-05-06 05:34:26 -0600

The only way for this to work is to use Configure External Console in the Debug I/O tool's Options menu and then check on the highlighted preference Use External Console. Wing will show a Windows Command window for I/O instead of using Debug I/O in the IDE window.

edit flag offensive delete link more


I love to use it in that way. Thank you.

daoming's avatar daoming  ( 2022-05-09 01:34:00 -0600 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools



Asked: 2022-05-05 21:24:24 -0600

Seen: 228 times

Last updated: May 09 '22