Thursday, November 28, 2019

Kivy - a Python based cross-platform framework

Kivy is a python based library for development of mobile apps including the natural user interface (NUI). It is cross platform library that can run on iOS, Android, Linus, Windows, OSX and Raspberry Pi with distribution protocol under free and open source software. It has been developed and is distributed by the Kivy Organisation.

Features :

  1. Supports multiple inputs including the mouse, WM_Touch, WN_Pen, Mac OS X Trackpad and Magic Mouse, Mtdev, Linux Kernel HID (Human Interface Device) and TUIO (Tangible User Interface Objects).
  2. Powerful, Stable and well documented API with programming guide to get started.
  3. It is business friendly, 100% free to use under MIT license
  4. Support for lot of widgets.
  5. Good Documentation.
  6. It is GPU accelerated as the graphics engine is built over OpenGL ES 2, using a modern and fast graphics pipeline.
Installation and Configuration of Kivy

Kivy can be installed on any Operating System without any compatibility issues. It can be downloaded from https://kivy.org/#download, and once it is done, the installation instructions are provided on the download page.


$ python -m pip install kivy


$ python -m pip install ffpyplayer

Configuring Kivy :

MacOS : /Users/Username/.kivy/config.ini

Windows : C:\Users\Username\.kivy\config.ini

Linux: /home/user/.kivy/config.ini


Architecture of Kivy :





  1. Core Providers and Inputs This allows user to open a window, displaying images and text, playing audio, getting images from a camera, spelling correction etc
  2. Graphics Kivy’s graphics API is our abstraction of OpenGL. Kivy provide the graphics API that lets you draw things using simple metaphors that do not exist as such in OpenGL (e.g. Canvas, Rectangle, etc.).
  3. Core The code in the core package provides commonly used features such as Clock : You can use the clock to schedule timer events. Both one-shot timers and periodic timers are supported. Cache : If you need to cache something that you use often, you can use inbuilt class. Gesture Detection : It provides a simple gesture recognizer that you can use to detect various kinds of strokes, such as circles or rectangles. You can train it to detect your own strokes. Kivy Language : The kivy language is used to easily and efficiently describe user interfaces. Properties : Kivy provides property classes that links the widget code with the user interface description.
  4. UIX Widget : Widgets are user interface elements that you add to your program to provide some kind of functionality. They may or may not be visible. Eg: Buttons, Label etc Layouts : User can use layouts to arrange the widgets. Eg: Grid layout, Box layout, Relative layout etc
  5. Widgets and Event Dispatching In Kivy, a widget is an object that receives input events. It does not necessarily have to have a visible representation on the screen. All widgets are arranged in a widget tree (which is a tree data structure as known from computer science classes). One widget can have any number of child widgets or none.
Kivy App Life Cycle :






Running the Application :

Linux : $ python main.py

Windows :


$ python main.py

or

C:\appdir>kivy.bat main.py

Mac OS X :

$ kivy main.py

No comments:

Post a Comment