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

Separating with the screen manager


Its useful for a new app to have the opportunity to use more than one screen to organize our app content. These screens could be different from each other. The screen manager is the widget that permits this. In this recipe, we will develop an app that has two screens with different widgets in each one.

Getting ready

The readers must be aware and familiar with the concepts of the previous chapter as we use them to create this app. Particularly, the recipe Using Swappable Widgets in Chapter 4, Widgets.

How to do it…

We are going to create a KV code where we define and set the screen manager. Also, we will have a Python code where we will create the two screens that will be part of the screen manager. To complete the task, follow these steps:

  1. In the KV file, import the screenmanager package.

  2. Define the rule for the root widget.

  3. Define BoxLayout for the buttons.

  4. Define the screenmanager widget, with the property transition.

  5. Define a new rule that controls the buttons...