Book Image

Kivy Cookbook

By : Hugo Solis
Book Image

Kivy Cookbook

By: Hugo Solis

Overview of this book

Table of Contents (16 chapters)
Kivy Cookbook
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Leveraging mobile features in iOS


There are a lot of features that mobile devices have nowadays. In this recipe, we will learn how to take advantage of this in our iOS apps. Also, we will use the accelerometer in the iOS app.

Getting ready

We will create an iOS package in this recipe. Thus, you should read the recipe Packaging for iOS in this chapter. In this app, we will also use code similar to that used in the recipe Working with the accelerometer in Chapter 2, Input, Motion, and Touch. We will need a KV file, which we will name e2.kv:

<Acce>:
    Label:
        id: label1
        pos: 150, 300
        text: 'X: '

    Label:
        id: label2
        pos: 150, 250
        text: 'Y: '

    Label:
        id: label3
        pos: 150, 200
        text: 'Z: '

    Label:
        id: status
        pos: 150, 150
        text: ''

    Button:
        id: button1
        pos: 150, 50
        text: 'Start'
        on_press: root.pressed1()

We will also need the Python file, main.py:

import...