Book Image

Kivy - Interactive Applications and Games in Python

By : Roberto Ulloa
Book Image

Kivy - Interactive Applications and Games in Python

By: Roberto Ulloa

Overview of this book

Table of Contents (13 chapters)
Kivy – Interactive Applications and Games in Python Second Edition
Credits
About the Author
About the Reviewers
www.PacktPub.com
Preface
Index

Comic Creator: PushMatrix and PopMatrix


Let's insert some graphics to the project we started in Chapter 1, GUI Basics – Building an Interface. Before this, we need to recapitulate two important lessons of this chapter related to the coordinate space:

  • The coordinate space is not restricted to any position or size. It normally has its origin in the bottom-left corner of the screen. To avoid this, we use RelativeLayout, which internally performs a translation to the position of the Widget.

  • Once the coordinate space context is transformed by any instruction, it stays like that until we specify something different. RelativeLayout also addresses this problem with two contextual instructions, which we will study in this section: PushMatrix and PopMatrix.

We use RelativeLayout in this section to avoid the problems of the shared coordinate space, but we will also explain the alternatives to it when we are inside any other type of Widget. We will add a new file (comicwidgets.kv) to our project. In comicreator...