[Pyobjc-dev] Return value "handler" / NSEvent.addLocalMonitorForEventsMatchingMask_handler_
Brought to you by:
ronaldoussoren
From: Just v. R. <jus...@gm...> - 2017-12-01 17:30:09
|
From a running PyObjC/Cocoa app, I try to do the following: from AppKit import NSKeyDownMask, NSEvent def myHandler(event): print(event) return event mask = NSKeyDownMask monitor = NSEvent.addLocalMonitorForEventsMatchingMask_handler_(mask, myHandler) (one could call this in an applicationDidFinishLaunching_() app delegate method) The handler indeed gets called when I press a key, but the caller complains it’s returning None: ValueError: <function myHandler at 0x1146b4c80>: returned None, expecting a value As you can see in my code above, the handler _does_ return a value, and I know from the print() output that it’s indeed not None. Can a handler return something with PyObjC, or should I do something special with the cal/function/lmethod signature? Thanks for any clues, Just |