Welcome!
This is the community forum for my apps Pythonista and Editorial.
For individual support questions, you can also send an email. If you have a very short question or just want to say hello — I'm @olemoritz on Twitter.
Pure Python gestures
-
@mikael Do you think it would be possible to use you gestures module on an objectiveC object?
I want to add gestures on a SceneView object, but functions like tap require their view parameter as an object having objc_instance property (see UIGestureRecognizerDelegate init).
-
@mikael I solved it with
def scene_view_tap(self,sender): location = self.recognizer.locationInView_(self.scene_view) node = self.scene_view.hitTest_options_(location,None) print(node) . . . self.gesture_recognizer_target = ui.Button() self.gesture_recognizer_target.action = self.scene_view_tap UITapGestureRecognizer = ObjCClass('UITapGestureRecognizer') self.recognizer = UITapGestureRecognizer.alloc().initWithTarget_action_(self.gesture_recognizer_target, sel('invokeAction:')).autorelease() scene_view.addGestureRecognizer_(self.recognizer) self.scene_view = scene_view
-
@cvp, forgot to advertise earlier that the latest version of gestures in the ui3 module accepts ObjC views in addition to ui module views.
from ui3.gestures import * tap(objc_view, handler)
-
@mikael thanks, I'll try
Édit: done, ok
Re-Edit: marvelous module -
This post is deleted!