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.
Tabbed panel
The TabbedPanel widget manages different widgets in tabs, with a header area for the actual tab buttons and a content area for showing the current tab content.
The TabbedPanel provides one default tab.
To use it must import :
from kivy.uix.tabbedpanel import TabbedPanel
Basic Approach:
1) import kivy
2) import kivy App
3) import floatlayout
4) import tabbedpanel
5) set minimum version(optional)
6) Create Tabbed panel class
7) create the App class
8) create .kv file:
# create multiple tabs in it.
# Do there functioning also.
9) return the widget/layout etc class
10) Run an instance of the class
Implementation Of Approach:
.py file
import kivy
from kivy.app import App
kivy.require( '1.9.0' )
from kivy.uix.tabbedpanel import TabbedPanel
from kivy.uix.floatlayout import FloatLayout
class Tab(TabbedPanel):
pass
class TabbedPanelApp(App):
def build( self ):
return Tab()
if __name__ = = '__main__' :
TabbedPanelApp().run()
|
.kv file
<Tab>:
size_hint: . 5 , . 5
pos_hint: { 'center_x' : . 5 , 'center_y' : . 5 }
do_default_tab: False
TabbedPanelItem:
text: 'Tab 1'
Label:
text: "First tab"
TabbedPanelItem:
text: 'Tab 2'
BoxLayout:
Label:
text: 'Press button'
Button:
text: 'Click it'
TabbedPanelItem:
text: 'Tab 3'
RstDocument:
text: '\n' .join(( "How are you GFG's???" ))
|
Output:
Tab 1:

Tab 2:

Tab 3:

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!
Last Updated :
18 Oct, 2021
Like Article
Save Article