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.
Getting at ObjC touch instance from Scene?
trey last edited by trey
I have a Scene-based program where I’d like to distinguish between finger and Pencil touch events.
An example from omz showed how to do this in a
ui.View; in the
def touch_moved(self, touch): ui_touch = ObjCInstance(touch)
then, I have verified, you can check the value of
ui_touch.type()to determine if the touch is from a finger (0) or a Pencil (2).
Unfortunately, I found out if you attempt to do the same in a
touchargument to the methods is not compatible with
ObjCInstance. You get:
ctypes.ArgumentError: argument 1: <class 'TypeError'>: wrong type
so, I’m wondering how I can get at a
Touchobject I can use the ObjC bridge with via a
mikael last edited by
@trey, one idea would be to place a transparent view on top (as a subview of scene.view) to handle the touches.
Then you would need to check if the touch is near the top-right corner to simulate clicking on the ”x” with
superview.close(). And remember to flip the y coordinate before passing the coordinate and touch type to your scene code. And maybe go via screen coordinates if you do a lot of zooming and panning in your scene.