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 Desktop applications.
Now in this article, we will learn how to build a button in kivy by using the kv file, just like the button we use in calculators and many more places.
The Button is a Label with associated actions that are triggered when the button is pressed (or released after a click/touch). To bind the action of button when it pressed we have the function on_press.
Basic Approach for the button Actions using .kv file:
1) Import kivy 2) Import kivy app 3) Import Box layout 4) create .kv with label and button 5) Bind button to a method 6) create method
.kv file of the above code [action.kv] :
Must be saved with the name of the
ActionApp class. i.e
Video explaning output:
BoxLayout arranges widgets in either in a vertical fashion that is one on top of another or in a horizontal fashion that is one after another.
- Floating Action type button in kivy - Python
- Animated Floating Action Button in kivy - Python
- Python | Toggle button in kivy using .kv file
- Python - Rounding button corners in kivy
- 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
- PyQt5 – How to add action to a button ?
- PyQt5 - Adding action to Radio Button
- Disable Kivy Button
- Use image as a button in kivy
- Disable kivy button using .kv file
- Change button Color in Kivy
- Add image button using .kv file in kivy
- Text Input box with a verification button in kivy
- Change the size and position of button in Kivy
- Text Input box with a verification button in kivy (using .kv file)
- Circular (Oval like) button using canvas in kivy (using .kv file)
- Action Chains in Selenium Python
- click_and_hold - Action Chains in Selenium Python
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.