In this video we’ll learn how to create Sliders for Kivy and Python.

Slider for Kivy are incredibly easy to create. You just define them in your .kv file, add a min and max value, then create an on_value function to do, whatever you want the slider to do.

In this video we’ll just output the value of the slider to the screen (numbers between 1 and 50). We’ll also increase the font size of our label to whatever our Slider value is.

Python Code:
GitHub Code:

from import App
from kivy.uix.widget import Widget
from import ObjectProperty
from kivy.lang import Builder
#from kivy.uix.slider import Slider

# Designate Our .kv design file 

class MyLayout(Widget):
	def slide_it(self, *args):
		self.slide_text.text = str(int(args[1]))
		self.slide_text.font_size = str(int(args[1]) * 5)

class AwesomeApp(App):
	def build(self):
		return MyLayout()

if __name__ == '__main__':

Kivy Design Code: slider.kv
GitHub Code: slider.kv

	slide_text: slider_label
		orientation: "vertical"
		size: root.width, root.height
			id: slider_label
			text: "Slide The Slider!"
			font_size: 32

			min: 1
			max: 50
			step: 1
			orientation: "horizontal"
			on_value: root.slide_it(*args)


John Elder

John is the CEO of where he teaches over 100,000 students how to code! He founded one of the Internet's earliest advertising networks and sold it to a publicly company at the height of the first dot com boom. After that he developed the award-winning Submission-Spider search engine submission software that's been used by over 3 million individuals, businesses, and governments in over 42 countries. He's written several Amazon #1 best selling books on coding, and runs a popular Youtube coding channel.

View all posts

Add comment

Your email address will not be published. Required fields are marked *

John Elder