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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
daoming's avatar
21
daoming
asked 3 years ago
Wingware Support's avatar
4.3k
Wingware Support
updated 3 years ago

Comments

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.

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)
Wingware Support's avatar
4.3k
Wingware Support
answered 3 years ago
link

Comments

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

daoming's avatar daoming (3 years ago)
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

To enter a block of code:

  • enter empty line after your previous text
  • paste or type the code
  • select the code and press the button above
Preview: (hide)