r/PyScript • u/AgitatedBelly • Jul 20 '22
TouchEvent
Hi there.
I've got a small test app going which responds to mousedown, mousemove, mouseup fine manipulating a canvas, but when I try to make it use touchstart, touchmove, and touchend, and it is trying to access event.touches[0], it gets TypeError: 'pyodide.JsProxy' object is not subscriptable. Logging a dir of event.touches shows me the guts of the Proxy object but doesn't give me a clue as to what to look at next to figure out if I have to access touches in a special way or something.
Can anyone give me any clues as to what to investigate?
Cheers, Nev.
View all comments
Show parent comment
2
u/AgitatedBelly Jul 20 '22 edited Jul 20 '22
Hi, thanks for your reply!
Here is some minimal code to show the issue. to_py() does show it as a TouchList {0: Touch, length: 1}, and yes event.touches.item(0) does work.
Cheers!