Search icon
Subscription
0
Cart icon
Close icon
You have no products in your basket yet
Arrow left icon
All Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Newsletters
Free Learning
Arrow right icon
Kivy: Interactive Applications in Python

You're reading from  Kivy: Interactive Applications in Python

Product type Book
Published in Sep 2013
Publisher Packt
ISBN-13 9781783281596
Pages 138 pages
Edition 1st Edition
Languages
Author (1):
Roberto Ulloa Roberto Ulloa
Profile icon Roberto Ulloa

Table of Contents (13) Chapters

Kivy: Interactive Applications in Python
Credits
About the Author
Acknowledgments
About the Reviewers
www.PacktPub.com
Preface
1. GUI Basics – Building an Interface 2. Graphics – The Canvas 3. Widget Events – Binding Actions 4. Improving the User Experience 5. Invaders Revenge – An Interactive Multitouch Game Index

Fleet – infinite concatenation of animations


In the last section we studied how we can concatenate two animations. What happens if we want to have an object that is constantly moving from right to left and vice versa? This is the case of the Fleet: we want it constantly moving from left to right, like the yellow arrows of the following screenshot cut show:

Note

We can concatenate two animations with the on_complete event.

The following code fragment 1 (of 2) of fleet.py shows how to concatenate these events:

155. # File name: fleet.py (Fragment 1)
156. from kivy.uix.gridlayout import GridLayout
157. from kivy.properties import ListProperty
158. from kivy.animation import Animation
159. from kivy.clock import Clock
160. from kivy.core.window import Window
161. from random import randint, random
162. from dock import Dock
163. 
164. class Fleet(GridLayout):
165.   survivors = ListProperty(())
166. 
167.   def __init__(self,  **kwargs):
168.     super(Fleet, self).__init__(**kwargs)
169.     for...
lock icon The rest of the chapter is locked
Register for a free Packt account to unlock a world of extra content!
A free Packt account unlocks extra newsletters, articles, discounted offers, and much more. Start advancing your knowledge today.
Unlock this book and the full library FREE for 7 days
Get unlimited access to 7000+ expert-authored eBooks and videos courses covering every tech area you can think of
Renews at $15.99/month. Cancel anytime}