Skip to Content
Creating Apps in Kivy
book

Creating Apps in Kivy

by Dusty Phillips
April 2014
Beginner to intermediate content levelBeginner to intermediate
188 pages
4h 17m
English
O'Reilly Media, Inc.
Content preview from Creating Apps in Kivy

Chapter 6. Kivy Storage

So far, every time you run your weather app, it asks you to search for a location. It would be much more convenient if it could store your last location and render it by default.

Kivy is a Python library, which means you have access to the full gamut of Python storage modules. You could use basic file I/O, compression, encryption, pickling, JSON, SQLite3, an external SQL or NoSQL database, or any number of online storage services.

Depending on the data being stored, these are certainly useful tools worth checking out. However, Kivy also provides a simple but powerful key/value storage API for storing local data. Its primary advantage is that because Kivy is aware of the module, it works across the wide variety of platforms that Kivy uses without having to take into account filesystem structure or other differences between various operating systems.

Maintaining a List of Locations

Before looking at storing the locations, update the app to have a Locations tab. This involves nothing you haven’t studied before, so you may want to think of it as an exercise. I’ll try to keep this section brief so as not to bore you with knowledge you already have. If you want to skip this section, you can download the example code from O’Reilly and proceed to the next section.

Here’s what you need to do, step by step. As mentioned, there is some example code for the more complicated steps. Note in advance that the ListView of locations behaves exactly like the ListView for search ...

Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Start your free trial

You might also like

Kivy - Interactive Applications and Games in Python

Kivy - Interactive Applications and Games in Python

Roberto Ulloa
Kivy Cookbook

Kivy Cookbook

Hugo Solis
Kivy Blueprints

Kivy Blueprints

Mark Vasilkov

Publisher Resources

ISBN: 9781491947333ErrataSupplemental Content