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

Animation – hiding a widget


In this section, we will make the control bar disappear when the video starts playing in order to watch the video without visual distractions. We need to change the videocontroller.py file in order to animate the ControlBar instance:

279. # File name: videocontroller.py
280. from kivy.animation import Animation
281. from kivy.properties import ObjectProperty
282. ...
283. class VideoController(FloatLayout):
284.     playing = ObjectProperty(None)
285. 
286.     def on_playing(self, instance, value):
287.         if value:
288.             self.animationVB = Animation(top=0)
289.             self.control_bar.disabled = True
290.             self.animationVB.start(self.control_bar)
291.         else:
292.             self.play_pause.state = 'normal'
293.             self.control_bar.disabled = False
294.             self.control_bar.y = 0
295. 
296.     def on_touch_down(self, touch):
297.         if self.collide_point(*touch.pos):
298.             if hasattr(self...