Quick search

Table Of Contents

SelectableDataItem

New in version 1.5.

Warning

This code is still experimental, and its API is subject to change in a future version.

Data Models

Kivy is open about the type of data used in applications built with the system. However, base classes are sometimes needed to ensure data conforms to the requirements of some parts of the system.

A SelectableDataItem is a basic Python data model class that can be used as a mixin to build data objects that are compatible with Kivy’s Adapter and selection system, which works with views such as a ListView. The boolean property is_selected is a requirement.

The default operation of the selection system is to not propogate selection in views such as ListView to the underlying data – selection is by default a view-only operation. However, in some cases, it is useful to propogate selection to the actual data items.

You may, of course, build your own Python data model system as the backend for a Kivy application. For instance, to use the Google App Engine datamodeling system with Kivy, this class could be redefined as:

from google.appengine.ext import db

class MySelectableDataItem(db.Model):
    ... other properties
    is_selected = db.BooleanProperty()

It is easy to build such a class with plain Python.

class kivy.adapters.models.SelectableDataItem(**kwargs)[source]

Bases: object

A mixin class containing requirements for selection operations.

This is the is_selected boolean property.

is_selected[source]

Is the data item selected