Using Python 3.7 with IDLE, on Mac. I want to be able to monitor key presses and immediately return either the character or its ASCII or Unicode value. I can't see how to use pynput with Idle. Any ideas please?
You can't. IDLE uses the tkinter interface to the tcl/tk GUI framework. The IDLE doc has a section currently title 'Running user code' with this paragraph.
When Shell has the focus, it controls the keyboard and screen. This is normally transparent, but functions that directly access the keyboard and screen will not work. These include system-specific functions that determine whether a key has been pressed and if so, which.