ronaldoussoren / pyobjc

The Python <-> Objective-C Bridge with bindings for macOS frameworks
https://pyobjc.readthedocs.io
563 stars 47 forks source link

CGEventPostToPid seems not work #564

Closed zhecks closed 1 year ago

zhecks commented 1 year ago

Describe the bug send mouse event by CGEventPostToPid to an application which listen mouse click event,but it seems not work

Platform information

Python 3.9.10 homebrew macOS Big Sur 11.6

To Reproduce event = Quartz.CGEventCreateMouseEvent(None, Quartz.kCGEventLeftMouseDown, (0, 0), Quartz.kCGMouseButtonLeft) Quartz.CGEventPostToPid(6935, event)

Expected behavior the application will print mouse click

Additional context no error return for pyobjc

zhecks commented 1 year ago

i look this discussion https://stackoverflow.com/questions/42657655/how-to-send-mouse-click-event-to-a-window-in-mac-osx

ronaldoussoren commented 1 year ago

Looking at that SO article the problem isn't in PyObjC, but is due to a macOS feature.