Nerd For Tech
Published in

Nerd For Tech

How to Change the Screen Transition in Kivy

The default transition is the SlideTransition, but there are many different types. You can also specify NoTransition.

Since the slide transition is the default, it is not necessary to import anything. You need to import all other transitions in the .kv file at the top of your file.

This is a screenshot from the Kivy Screen Manager page with the available transitions: https://kivy.org/doc/stable/api-kivy.uix.screenmanager.html

Use this syntax in your ScreenManager in your .kv file to change the default transition:

#: import WipeTransition kivy.uix.screenmanager.WipeTransition<ScreenManager>:
transition: WipeTransition()

You can change the transition within your file. **Important: Once you change the transition in one location, it will apply to all the following transitions unless you specifically change it again.**

#: import WipeTransition kivy.uix.screenmanager.WipeTransition<ExampleScreen>:    GridLayout:
cols: 1
Button:
text: "Change the Direction of Default SlideTransition":
on_release:
root.manager.transition.direction = "right"
root.manager.current = "new_screen"
Button:
text: "Change Transition Type"
on_release:
root.manager.transition = WipeTransition()
root.manager.current = "new_screen"

--

--

Get the Medium app

A button that says 'Download on the App Store', and if clicked it will lead you to the iOS App store
A button that says 'Get it on, Google Play', and if clicked it will lead you to the Google Play store