Kivy - Garden



Kivy Garden is a repository of Kivy widgets developed by individual users. It is a project maintained by the users and its aim is to centralize the addons for Kivy. The user contributed Kivy packages are hosted on Kivy Garden repository https://github.com/kivy-garden.

The widgets developed by users and uploaded to the Garden repository are called Flowers. The flowers in Kivy Garden are of two types. Those before Kivy version 1.11.0 are the legacy flowers. To install the legacy flower widgets you need to use the command −

garden install flower-name

The legacy flowers are not the proper Python packages, and are named with garden prefix attached to it. For example, a widget used as a Matplotlib backend for Kivy is garden.matplotlib.

On the other hand, the new flowers are Python packages which are hosted on PyPI repository and therefore installed with the regular pip utility.

pip install flower

The modern Kivy flowers are not having the garden prefix. For example the mapview widget provides a container for displaying interactive maps in a Kivy app.

pip install mapview

You can install master directly from github. For example, the following command installs the graph flower −

python -m pip install

https://github.com/kivy-garden/graph/archive/master.zip

Example

Let us use the mapview flower in a Kivy application −

from kivy_garden.mapview import MapView
from kivy.app import App
from kivy.core.window import Window
Window.size = (720,400)

class MapViewApp(App):
   def build(self):
      mapview = MapView(zoom=11, lat=50.6394, lon=3.057)
      return mapview
      
MapViewApp().run()

Output

When you run this code, it will produce the following output window −

Kivy Garden
Advertisements