Pythonista-Issues
Pythonista-Issues copied to clipboard
scene.touch python object missing some fields of the UITouch ObjC object
The scene.touch python object does not have all the fields of the UITouch ObjC object.
Specifically, the majorRadius, or attributes like force https://developer.apple.com/documentation/uikit/uitouch
I was looking for a workaround, but I don't know how to obtain a reference to the ObjC object UITouch from the scene.touch python object.
Example code:
from scene import *
from objc_util import ObjCInstance
class MyScene(Scene):
def touch_began(self, touch):
# Determine the circle's radius based on touch force (or use a default)
print(dir(touch))
force=touch.force # does not work
r=touch.majorRadius # does not work, etc
# Run the scene
run(MyScene())
System Information
iPhone:
**System Information**
* Pythonista N/A (N/A), Default interpreter 3.10.4
* iOS 17.7, model iPhone15,4, resolution (portrait) 1179.0 x 2556.0 @ 3.0
iPad:
**System Information**
* Pythonista N/A (N/A), Default interpreter 3.10.4
* iOS 17.6.1, model iPad11,6, resolution (portrait) 1620.0 x 2160.0 @ 2.0
Thanks very much for the very useful Pythonista software!