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.
Animation:
Animation and AnimationTransition are used to animate Widget properties. You must specify at least a property name and target value. To use Animation, follow these steps:
- Setup an Animation object
- Use the Animation object on a Widget
To use animation you must have to import:
from kivy.animation import Animation
Basic Approaches:
1) import kivy
2) import kivyApp
3) import Button
4) import Animation
5) set kivy version (optional)
6) Create the App class
7) Define animation
8) Add animations
9) Run the App
Implementation of the Approach:
import kivy
kivy.require( "1.9.1" )
from kivy.app import App
from kivy.animation import Animation
from kivy.uix.button import Button
class TestApp(App):
def animate( self , instance):
animation = Animation(pos = ( 100 , 100 ), t = 'out_bounce' )
animation + = Animation(pos = ( 200 , 100 ), t = 'out_bounce' )
animation & = Animation(size = ( 500 , 500 ))
animation + = Animation(size = ( 100 , 50 ))
animation.start(instance)
def build( self ):
button = Button(size_hint = ( None , None ), text = 'plop' ,
on_press = self .animate)
return button
if __name__ = = '__main__' :
TestApp().run()
|
Output:

When the Button as shown in the image when you click on it it shows the different animation.
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!