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. ...

Get Kivy – Interactive Applications and Games in Python - Second Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.