How to implement mouse gesture by python or pyqt ?
-
It would be better to give me some examples .thanks in advance !
P.S. which module or lib are needed ?
-
what I wanna perhaps like this:
when a right mouse button is pressed and we go down and right with a cursor. As in letter 'L'. Our mouse gesture will close the window.
I googled such gesture examples on PyQt4 ,but hard to find one ,so your help will be greatly appreciated !
thanks inadvance ! -
Johan Thelin wrote a really nice example of this (in C++) for Qt Quarterly back in 2006: "Recognizing Mouse Gestures":http://doc.qt.digia.com/qq/qq18-mousegestures.html. I've created a Python/PyQt port of this but as its 350+ lines I've posted it on my "blog":http://www.gulon.co.uk/2013/01/09/recognising-mouse-gestures-with-pyqt4/ rather than here.
Hope this helps.
-
[quote author="jazzycamel" date="1357732711"]Johan Thelin wrote a really nice example of this (in C++) for Qt Quarterly back in 2006: "Recognizing Mouse Gestures":http://doc.qt.digia.com/qq/qq18-mousegestures.html. I've created a Python/PyQt port of this but as its 350+ lines I've posted it on my "blog":http://www.gulon.co.uk/2013/01/09/recognising-mouse-gestures-with-pyqt4/ rather than here.
Hope this helps.[/quote]
Thanks very very very much jazzycamel.Your help is greatly appreciated.
But I think Qt already have framework for mouse gesture .see here
http://doc.qt.digia.com/qt/gestures-overview.html
Although I cannot make use of the knowledge there due to a lack of PyQt programming experience ,but I still think it can helps us simplify the mouse gesture program design.
please forgive my greedy request ,can you give a another version by using the knowledge aforementioned .thanks in advance ! -
I am aware of the existence of QGesture, QGestureRecognizer etc., the example (and my Python port) probably predates this framework, I did create it sometime ago and only refreshed it in response to your original request for an example.
In response to your subsequent request I have created an example with almost equivalent functionality using the newer methods. As before, it can be found on my blog "here":http://www.gulon.co.uk/2013/01/14/pyqt4-mouse-gestures-part-deux/.