Support for gestures like swiping in PyQt5

Giuseppe Corbelli corbelligiuseppe at
Wed Feb 24 10:03:39 GMT 2021

On 2/24/21 9:40 AM, Frans Fürst wrote:
> I'm trying to make a PyQt5 application for Android react to swipe 
> gestures (in order to let the user swipe through pictures). I didn't 
> find much documentation about this (neither for C++ nor Python) but I 
> came up with an approach which looks plausible to me:
> |class MyViewer(QtWidgets.QLabel): def __init__(self, parent=None): 
> super().__init__(parent=parent) self.grabGesture(QtCore.Qt.SwipeGesture) 
> def event(self, event): if event.type() == QtCore.QEvent.Gesture: # <= 
> this won't happen print("Hello event!") return super().event(event)|
> The app runs without errors but the event() method does not receive any 
> events that look like gestures (at least on Android an Linux, but I 
> don't know if I have to expect gestures work on Linux at all).
> I've posted a question on StackOverflow, but with no answers yet: 
> <>
> Are there any known issues with gestures on Android with PyQt5?
> Did I forget something important? Or am I on a totally wrong path here?

As far as I can tell you're on the right path.
I assume you've started from

On a desktop platform it does not likely work out of the box:

Giuseppe Corbelli

More information about the PyQt mailing list