Kivy is a platform independent GUI tool in Python. As it can be run on Android, IOS, linux and Windows etc. It is basically used to develop the Android application, but it does not mean that it can not be used on Desktops applications.
???????? Kivy Tutorial – Learn Kivy with Examples.
Accordion:
The Accordion widget is a form of the menu where the options are stacked either vertically or horizontally and the item in focus (when touched) opens up to display its content.
It can contain many item instances, each of which should contain one root content widget. It will be end up like a tree.
The current implementation divides the AccordionItem into two parts:
- One container for the title bar(made from kv template)
- One container for the content
Basic Approach:
1) import kivy
2) import kivyApp
3) import Accordion
4) Set minimum version(optional)
5) Create Accordion class
6) Create App class
7) create .kv file (name same as the app class)
8) return Layout/widget/Class(according to requirement)
9) Run an instance of the class
Implementation of the Approach:
.py file:
Python3
import kivy
from kivy.app import App
kivy.require( '1.9.0' )
from kivy.uix.accordion import Accordion
class Accor(Accordion):
pass
class AccorApp(App):
def build( self ):
return Accor()
if __name__ = = '__main__' :
AccorApp().run()
|
.kv file:
Python3
<MyImage@Image>:
keep_ratio: False
allow_stretch: True
<Accor>:
orientation: 'vertical'
AccordionItem:
title: 'HTML 5'
MyImage:
source: 'html.png'
AccordionItem:
title: 'CSS 3'
MyImage:
source: 'css.png'
AccordionItem:
title: 'JAVASCRIPT'
MyImage:
source: 'javascript.png'
AccordionItem:
title: 'NODE-JS'
MyImage:
source: 'node-js.png'
AccordionItem:
title: 'BOOTSTRAP'
MyImage:
source: 'bootstrap.png'
|
Output:





Whether you're preparing for your first job interview or aiming to upskill in this ever-evolving tech landscape,
GeeksforGeeks Courses are your key to success. We provide top-quality content at affordable prices, all geared towards accelerating your growth in a time-bound manner. Join the millions we've already empowered, and we're here to do the same for you. Don't miss out -
check it out now!