First time here? Check out the FAQ!
2

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

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:
    time.sleep(0.1)
  print('getting ch')
  c = msvcrt.getch()
  print(f'input: {c}')
  if c==b'e':
    exit()

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

daoming's avatar
21
daoming
asked 2022-05-05 21:24:24 -0500
Wingware Support's avatar
4k
Wingware Support
updated 2022-05-06 05:29:45 -0500
edit flag offensive 0 remove flag close merge delete

Comments

add a comment see more comments

1 Answer

1

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.

Wingware Support's avatar
4k
Wingware Support
answered 2022-05-06 05:34:26 -0500
edit flag offensive 0 remove flag delete link

Comments

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

daoming's avatar daoming (2022-05-09 01:34:00 -0500) edit
add a comment see more comments

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account. This space is reserved only for answers. If you would like to engage in a discussion, please instead post a comment under the question or an answer that you would like to discuss.

Add Answer