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

AsyncImage – creating a cover for the video


In this section, we will learn how to put up a cover that will be displayed when the video is not playing. This image will serve as a decoration when the video hasn't started, and in the case of the TED video, it is usually an image that involves the speaker. Let's start introducing a few changes in the code of video.kv:

58. # File name: video.kv 
59. ...
60. #:set _default_image "http://images.ted.com/images/ted/016a827cc0757092a0439ab2a63feca8655b6c29_1600x1200.jpg"
61. 
62. <Video>:
63.     cover: _cover
64.     image: _default_image
65.     ...
66.     AsyncImage:
67.         id: _cover
68.         source: root.image
69.         size: root.width,root.height

In this code, we created another constant (_default_image) with the set directive (line 60), and a related property (image) for the Video class that references the constant (line 64). We also created the cover property (line 63) to reference AsyncImage that we added to the Video class...