Forum Archive

Palm rejection in Pythonista?

superrune

Hi!

I have done a pixel art app with Pythonista. Everything is working as it should, and the painting experience is great through Python. But I wish the app had palm rejection when I used my Apple Pencil. Does anyone know if that is possible with Pythonista?

mikael

@superrune, yes, but you would need to change your app to use gestures (mainly panning, I guess, but tapping and pinching could of course be relevant as well), and only react to pen-based gestures.

Let me know if this would be a relevant option for you.

mikael

@superrune, sorry, it is probably easier than that. In your code, you can select pencil touches like this:

class Penned(ui.View):

    def touch_began(self, t):
        if t.objc_instance.type() == 2:
            ...

Note that this is a bit untested, as I do not have an Apple Pencil.