PTB 3.0.15 is end of life and unsupported. 3.0.16 had multiple workarounds in keyboard handling implemented for the broken pile of shit that is Catalina.
Does KbQueueDemo work? Does it work with the index returned by GetKeyboardIndices? If setting permissions for input monitoring doesn’t help, then i don’t know. I know this stuff should work on 10.15.3, but haven’t upgraded to 10.15.4 after 10.15.3 broke all external video outputs on my machine, this time with a botched firmware update, not only for Catalina but also for Mojave and Linux – a truly outstanding demonstration of engineering incompetence that now makes productive work and testing almost impossible on my only Catalina test machine. I’m too scared atm. to upgrade to 10.15.4, but i just read that this one additionally crashes if you try to copy big files from a to b.
Notice that Apple also broke that mechanism if you update Matlab, because their whole new security authorization workflow was designed by somebody without a functioning brain. You have to take away the permissions and set them again after each minor Matlab update. See the end of:
This is especially ironic, because Apple ran ads ridiculing Microsoft for doing exactly the same thing in Windows Vista that Apple now does ten years later in Catalina, just now with an even worse UI design. For your entertainment: