Jump to content

Kivy (framework)

From Wikipedia, the free encyclopedia

This is an old revision of this page, as edited by Doctor Che (talk | contribs) at 06:13, 29 August 2018 (New version). The present address (URL) is a permanent link to this revision, which may differ significantly from the current revision.

Kivy
Developer(s)Kivy organization
Initial releaseFebruary 1, 2011; 13 years ago (2011-02-01)[1]
Stable release
1.10.1 / 8 July 2018; 6 years ago (2018-07-08)[1]
Repository
Written inPython, Cython
Operating systemCross-platform
TypeApplication framework
LicenseMIT (Free software)
Websitekivy.org

Kivy is an open source Python library for developing mobile apps and other multitouch application software with a natural user interface (NUI). It can run on Android, iOS, Linux, OS X, and Windows. Distributed under the terms of the MIT license, Kivy is free and open source software.

Kivy is the main framework developed by the Kivy organization,[2] alongside Python for Android,[3] Kivy iOS,[4] and several other libraries meant to be used on all platforms. In 2012, Kivy got a $5000 grant from the Python Software Foundation for porting it to Python 3.3.[5] Kivy also supports the Raspberry Pi which was funded through Bountysource.[6]

The framework contains all the elements for building an application such as:

Kivy is the evolution of the PyMT project, and is recommended for new projects.[8]

Sister projects

  • Buildozer: generic Python packager for Android and iOS.
  • Plyer: platform-independent Python wrapper for platform-dependent APIs.
  • Pyjnius: dynamic access to the Java/Android API from Python.
  • Pyobjus: dynamic access to the Objective-C/iOS API from Python.
  • Python for Android: toolchain for building and packaging Python applications for Android.
  • Kivy iOS: toolchain for building and packaging Kivy applications for iOS.
  • Audiostream: library for direct access to the microphone and speaker.
  • Kivy Designer: UI designer for Kivy.
  • KivEnt: entity-based game engine for Kivy.
  • Garden: widgets and libraries created and maintained by users.
  • kivy-sdk-packager: Scripts for Kivy SDK generation on Windows, OS X and Linux
  • kivy-remote-shell: Remote SSH+Python interactive shell application.
  • KivyPie: Raspbian based distro running latest Kivy framework on the Raspberry Pi.
  • OSCPy: a fast and reliable OSC implementation compatible with python2.7 and 3.6+

Code example

Here is an example of the Hello world program with just one button:

from kivy.app import App
from kivy.uix.button import Button

class TestApp(App):
    def build(self):
        return Button(text='Hello World')

TestApp().run()

Kv language

The Kivy language (Kv) is a language dedicated to describing user interface and interactions. As with other user interface markup languages, it is possible to easily create a whole UI and attach interaction. For example, to create a Loading dialog that includes a file browser, and a Cancel / Load button, one could first create the base widget in Python, and then construct the UI in Kv.

In main.py:

class LoadDialog(FloatLayout):
    def load(self, filename): pass
    def cancel(self): pass

And in the associated Kv:

#:kivy 1.4.0
<LoadDialog>:
    BoxLayout:
        size: root.size
        pos: root.pos
        orientation: "vertical"
        FileChooserListView:
            id: filechooser

        BoxLayout:
            size_hint_y: None
            height: 30
            Button:
                text: "Cancel"
                on_release: root.cancel()

            Button:
                text: "Load"
                on_release: root.load(filechooser.path, filechooser.selection)

Google Summer of Code

Kivy participated in Google Summer of Code under Python Software Foundation.

  • Kivy in GSoC'2014.[9]
  • Kivy in GSoC'2015.[10]
  • Kivy in GSoC'2016.[11]

References

  1. ^ a b "Kivy changelog", kivy.org, retrieved 2016-04-05
  2. ^ "About us", kivy.org
  3. ^ "Python for Android", github.com
  4. ^ "Kivy for iOS", github.com
  5. ^ "Kivy and Python 3.3, project started", Google Groups
  6. ^ "Kivy on Raspberry Pi", bountysource.com
  7. ^ "Programming Guide » Kv language", kivy.org
  8. ^ "FAQ: How is Kivy related to PyMT?", kivy.org, retrieved 2012-06-09
  9. ^ "Google Summer of Code 2014 Organization Python Software Foundation". {{cite web}}: Cite has empty unknown parameter: |dead-url= (help)
  10. ^ "Google Summer of Code 2015 Organization Python Software Foundation". {{cite web}}: Cite has empty unknown parameter: |dead-url= (help)
  11. ^ "Google Summer of Code 2016 @ the Python Software Foundation". {{cite web}}: Cite has empty unknown parameter: |dead-url= (help)

See also