How to use Spinner, Image, Switch, Slider, and Progressbar in Kivy Python

 

https://www.kodularfreeaia.com/2025/07/how-to-use-spinner-image-switch-slider.html

In this article, I’ll walk you through some essential Kivy widgets and layouts that you’ll use to build clean, interactive, and beautiful mobile or desktop applications.

Whether you’re just starting out or already experimenting with app design in Python, this tutorial will help you understand how to use:

  • Spinner for dropdown menus,

  • Image widget to display pictures,

  • Slider for selecting values,

  • Switch for toggle actions, and

  • ProgressBar to track progress in your app.

We’ll cover everything step-by-step with live examples, so you can easily follow along and try it yourself.

So, let’s get started—and by the end of this video, you'll be able to use these components confidently in your own Kivy projects!


Spinner:
The Spinner is used to let users select an item from a dropdown list—similar to a dropdown in HTML.

from kivy.app import App
from kivy.uix.spinner import Spinner

class MyKivy(App):
    def build(self):
        return Spinner(values=['Apples','Oranges'], size_hint=(None,None), size=(200,50),pos_hint={'center_x': 0.5, 'center_y':0.5})

if __name__ == "__main__":
    MyKivy().run()

Image:
The Image widget allows you to display images from local files or URLs.

from kivy.app import App
from kivy.uix.image import Image

class MyKivy(App):
    def build(self):
        return Image(source='1.jpg', size_hint=(None,None), size=(500,500),pos_hint={'center_x': 0.5, 'center_y':0.5})

if __name__ == "__main__":
    MyKivy().run()

Slider:
The Slider lets users choose a numeric value by dragging a handle horizontally or vertically.

from kivy.app import App
from kivy.uix.slider import Slider

class MyKivy(App):
    def build(self):
        return Slider(min=0, max=100, value=50, size_hint=(None,None), size=(500,500),pos_hint={'center_x': 0.5, 'center_y':0.5})

if __name__ == "__main__":
    MyKivy().run()

Switch:
A Switch is like a toggle button (on/off). It's great for settings or feature control.

from kivy.app import App
from kivy.uix.switch import Switch

class MyKivy(App):
    def build(self):
        return Switch(active=True, size_hint=(None,None), size=(500,500),pos_hint={'center_x': 0.5, 'center_y':0.5})

if __name__ == "__main__":
    MyKivy().run()

Progressbar:
The ProgressBar visually represents the progress of a task. You can update it dynamically.

from kivy.app import App
from kivy.uix.progressbar import ProgressBar

class MyKivy(App):
    def build(self):
        return ProgressBar(value=50, size_hint=(None,None), size=(500,500),pos_hint={'center_x': 0.5, 'center_y':0.5})

if __name__ == "__main__":
    MyKivy().run()



If you enjoyed this video, please likesubscribe, and hit the bell icon so you don’t miss the next lesson.
And if anything was unclear, drop a comment — I’m always here to help.

Thanks for watching — I’ll see you in the next tutorial.
Until then, peace and happy coding!


Social Media Accounts: 

Youtube:

Pinterest:

Facebook :

Instagram:

Dribbble:

Behance:

Download Source Files:

Download

Post a Comment

Previous Post Next Post