Kivy — it is a platform independent GUI tool in Python. Since it can run on Android, IOS, Linux, Windows, etc. It is mainly used to develop Android application, but that does not mean that it cannot be used in desktop applications.
Screen Manager — it is a widget that is used to manage multiple screens for your application. ScreenManager by default only displays one screen at a time and uses TransitionBase to switch from one screen to another. Multiple transitions are supported.
The ScreenManager and Screen classes are imported. ScreenManager will be used for the root as:
from kivy.uix.screenmanager import ScreenManager, Screen
Note. By default, ScreenManager.transition is a SlideTransition with options direction and duration.
Basic Approach: 1) import kivy 2) import kivyApp 3) import Screen Manager, Screen, "" Transitions you want to use "" 4) Set minimum version (optional) 5) Create Different Screen classes and pass them 6) Create features of Screen classes in .kv file :: Add features in different screens 7) Create App class 8) return screen manager 9) Run an instance of the class pre>
Below is a code implementation with
You have multiple transitions available by default, such as: p>
- NoTransition - switches screens instantly with no animation
- SlideTransition - slide the screen in / out, from any direction
- CardTransition - new screen slides on the previous or the old one slides off the new one depending on the mode
- SwapTransition - implementation of the iOS swap transition
- FadeTransition - shader to fade the screen in / out
WipeTransition - shader to wipe the screens from right to left
- FallOutTransition - shader where the old screen `falls` and becomes transparent, revealing the new one behind it.
- RiseInTransition - shader where the new screen rises from the screen center while fading from transparent to opaque.
You can easily switch transitions by changing the ScreenManager.transition property:
sm = ScreenManager (transition = FadeTransition ())
Note: the code is the same, some points have been added to the code, do not confuse. p>
Output video of different transitions —