How to change screen transition in different screens
Put the transitions in on_release
events.
Button:
text: 'next screen'
on_release:
app.root.transition = SlideTransition(direction='right')
app.root.current = '2ndScreen'
...
For anyone else coming here looking for the answer to use entirely different transitions from one screen to another, this is what worked for me:
- Load the desired transitions at the top of the KV file with lines like this (hash included):
#: import FadeTransition kivy.uix.screenmanager.FadeTransition
#: import SlideTransition kivy.uix.screenmanager.SlideTransition
- Play around with this format changing the transition type to the desired type:
app.root.transition = FadeTransition(duration=1.2)
Keep it linked with your triggering event. I tried
on_release
for my login and sign off buttons but found that it was glitchy and not exactly the behavior I was going for. I ended up adding a line for
on_press
in order to create the desired transitions without the unexpected behavior. I kept the actual line that changes the screen under the
on_release
line.