Kivy is a platform-independent GUI tool in Python. It can run on Android, IOS, Linux and Windows, etc. This is the only GUI library from python which can independently run on an android device even we can use it on Raspberry Pi also. It is an open-source Python library for the rapid development of applications that make use of innovative user interfaces, such as multi-touch apps. Its graphic engine is built over OpenGL ES 2 and has fast graphics pipeline. If you are new to kivy you can learn from this link.
In this article, we will develop a GUI window using kivy framework of python, and we will add an image on this window(you can follow the same pattern for implementing double-tap event on other widgets also) and we will add a double-tap event on this image.
A basic approach to implement double-tap on image widget
- Import image widget from kivy package
- Import touchbehaviour from kivy package
- Import kivy app
- Import boxlayout from kivy package
- Add widget
- Extend the class
- Return layout
- Run an instance of the class
#window which contains our image
# adding our ImageWithDoubleTouch widget that we have created in main.py file
# adding path of image file
Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.
To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.