Search icon CANCEL
Subscription
0
Cart icon
Your Cart (0 item)
Close icon
You have no products in your basket yet
Arrow left icon
Explore Products
Best Sellers
New Releases
Books
Videos
Audiobooks
Learning Hub
Free Learning
Arrow right icon
Arrow up icon
GO TO TOP
Kivy ??? Interactive Applications and Games in Python second edition

You're reading from   Kivy ??? Interactive Applications and Games in Python second edition Create responsive cross-platform UI/UX applications and games in Python using the open source Kivy library

Arrow left icon
Product type Paperback
Published in Jun 2015
Publisher
ISBN-13 9781785286926
Length 206 pages
Edition 1st Edition
Languages
Tools
Arrow right icon
Author (1):
Arrow left icon
Roberto Ulloa Roberto Ulloa
Author Profile Icon Roberto Ulloa
Roberto Ulloa
Arrow right icon
View More author details
Toc

Table of Contents (8) Chapters Close

Preface 1. GUI Basics – Building an Interface FREE CHAPTER 2. Graphics – the Canvas 3. Widget Events – Binding Actions 4. Improving the User Experience 5. Invaders Revenge – an Interactive Multi-touch Game 6. Kivy Player – a TED Video Streamer 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...

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 $19.99/month. Cancel anytime
Banner background image