Here is an example from my understanding you are trying to achieve. It is based on the simplest ListView example. Please notice that I created an extended JSON version from the example you provided. Also, when you want to use the url, you have to substitute the 2 commented lines. The method for loading the json is load
(for io input) and not loads
(for string input).
from kivy.uix.listview import ListView
from kivy.uix.gridlayout import GridLayout
import json
import urllib2
class MainView(GridLayout):
def __init__(self, **kwargs):
kwargs['cols'] = 2
super(MainView, self).__init__(**kwargs)
the_string_json = '{"meta": {"previous": null, "total_count": 8, "offset": 0, "limit": 20, "next": null}, "objects": [{"id": 1, "page_count": 155, "description": "Cool book", "title": "Kivy book 1"}, {"id": 1, "page_count": 155, "description": "Cool book", "title": "Kivy book 2"}, {"id": 1, "page_count": 155, "description": "Cool book", "title": "Kivy book 3"}]}'
the_dict = json.loads(the_string_json)
# Substitute the previous two lines for this ones:
# the_io_json = urllib2.urlopen('mysite.com/api/books/?format=json')
# the_dict = json.load(the_io_json)
list_view = ListView(
item_strings=[book['title'] for book in the_dict['objects']])
self.add_widget(list_view)
if __name__ == '__main__':
from kivy.base import runTouchApp
runTouchApp(MainView(width=800))