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

ScrollView – displaying a list of videos


In this section, we will display the results of a search performed on the TED video site in a side bar that we can scroll up and down, as shown in the following screenshot:

Let's start defining the components of the side bar in the sidebar.kv file:

432. # File name: sidebar.kv
433. <ListItem>:
434.     size_hint: [1,None]
435.     height: 70
436.     group: 'listitem'
437.     text_size: [self.width-20, None]
438. 
439. 
440. <Sidebar@ScrollView>:
441.     playlist: _playlist
442.     size_hint: [None, None]
443.     canvas.before:
444.         Color:
445.             rgba: 0,0,0,.9
446.         Rectangle:
447.             pos: 0,0,
448.             size: self.width,self.height
449. 
450.     GridLayout:
451.         id: _playlist
452.         size_hint_y: None
453.         cols: 1

The ListItem class inherits from ToggleButton. The text_size property will establish a boundary for the text. If the titles of the videos are too long, two lines...

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