Reader small image

You're reading from  Kivy - Interactive Applications and Games in Python

Product typeBook
Published inJun 2015
Reading LevelBeginner
Publisher
ISBN-139781785286926
Edition1st Edition
Languages
Tools
Right arrow
Author (1)
Roberto Ulloa
Roberto Ulloa
author image
Roberto Ulloa

Roberto Ulloa has a diverse academic record in multiple disciplines within the field of computer science. Currently, he is working with artificial societies as part of his PhD thesis at the University of Western Ontario. He obtained an MSc degree from the University of Costa Rica and taught programming and computer networking there. He has earned a living as a web developer, working with Python/Django and PHP/Wordpress. He collaborates with various researchers while also working on his own projects, including his blog (http://robertour.com). He constantly worries that the Internet has already become aware of itself and that we are not able to communicate with it because of the improbability of it being able to speak any of the 6,000-plus odd human languages that exist on the planet.
Read more about Roberto Ulloa

Right arrow

Control bar – adding buttons to control the video


In this section, we will work on user interaction with the application. Right now, we control the video with touches on the screen that play, pause, and stop the video. However, this is not very intuitive for a new user of our application. So, let's add some buttons to improve the usability of our application.

We will use Image widgets enhanced with ToggleButtonBehaviour and ToggleBehaviour classes in order to create buttons for a play/pause button and a stop button, respectively. Here is a cropped screenshot of the simple control bar that we will be implementing in this section:

Let's start defining our two widgets for controlbar.kv. We will cover each widget one by one. Let's start with the header of the file and the ControlBar class definition:

178. # File name: controlbar.kv
179. <ControlBar@GridLayout>:
180.     rows: 1
181.     size_hint: None, None
182.     pos_hint: {'right': 1}
183.     padding: [10,0,0,0]
184.     play_pause...
lock icon
The rest of the page is locked
Previous PageNext Page
You have been reading a chapter from
Kivy - Interactive Applications and Games in Python
Published in: Jun 2015Publisher: ISBN-13: 9781785286926

Author (1)

author image
Roberto Ulloa

Roberto Ulloa has a diverse academic record in multiple disciplines within the field of computer science. Currently, he is working with artificial societies as part of his PhD thesis at the University of Western Ontario. He obtained an MSc degree from the University of Costa Rica and taught programming and computer networking there. He has earned a living as a web developer, working with Python/Django and PHP/Wordpress. He collaborates with various researchers while also working on his own projects, including his blog (http://robertour.com). He constantly worries that the Internet has already become aware of itself and that we are not able to communicate with it because of the improbability of it being able to speak any of the 6,000-plus odd human languages that exist on the planet.
Read more about Roberto Ulloa