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.
The ToggleButton widget acts like a checkbox. When you touch or click it, the state toggles between ‘normal’ and ‘down’ (as opposed to a Button that is only ‘down’ as long as it is pressed).
Toggle buttons can also be grouped to make radio buttons – only one button in a group can be in a ‘down’ state. The group name can be a string or any other hashable Python object:
btn1 = ToggleButton(text='Male', group='sex', ) btn2 = ToggleButton(text='Female', group='sex', state='down') btn3 = ToggleButton(text='Mixed', group='sex')
Only one of the buttons can be ‘down’/checked at the same time. To configure the ToggleButton, you can use the same properties that you can use for a Button class.
Basic Approach: 1) import kivy 2) import kivyApp 3) import toggle button 4) import Gridlayout 5) Set minimum version(optional) 6) create layout class 7) create App class 8) create the, kv file 9) return Layout/widget/Class(according to requirement) 10) Run an instance of the class
- Python - Change button color in kivy using .kv file
- Python - Rounding button corners in kivy using .kv file
- Python - Change kivy button size and position using kv file
- Disable kivy button using .kv file
- Add image button using .kv file in kivy
- Circular (Oval like) button using canvas in kivy (using .kv file)
- Text Input box with a verification button in kivy (using .kv file)
- Python | Button Action in Kivy
- Python - Rounding button corners in kivy
- Animated Floating Action Button in kivy - Python
- Floating Action type button in kivy - Python
- Python | Kivy .kv File
- Python | TextInput in kivy using .kv file
- Python | PageLayout in Kivy using .kv file
- Python | Accordion in kivy using .kv file
- Python | StackLayout in Kivy using .kv file
- Python | AnchorLayout in Kivy using .kv file
- Python | FloatLayout in Kivy using .kv file
- Python | ScreenManager in Kivy using .kv file
- Python | File chooser in kivy
If you like GeeksforGeeks and would like to contribute, you can also write an article using contribute.geeksforgeeks.org or mail your article to firstname.lastname@example.org. See your article appearing on the GeeksforGeeks main page and help other Geeks.
Please Improve this article if you find anything incorrect by clicking on the "Improve Article" button below.