Last active
January 29, 2022 02:03
-
-
Save gottadiveintopython/62c47b589138963717182bcb1023e1da to your computer and use it in GitHub Desktop.
kivy.garden.moretransitions が更新されたようなので試してみた
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from kivy.app import runTouchApp | |
from kivy.lang import Builder | |
from kivy.uix.button import Button | |
from kivy.garden.moretransitions import ( | |
PixelTransition, RippleTransition, BlurTransition, RVBTransition, | |
RotateTransition, TileTransition, FastSlideTransition, | |
) | |
ALL_TRANSITIONS = ( | |
PixelTransition, RippleTransition, BlurTransition, RVBTransition, | |
RotateTransition, TileTransition, FastSlideTransition, | |
) | |
root = Builder.load_string(''' | |
BoxLayout: | |
ScreenManager: | |
id: manager | |
Screen: | |
name: '1' | |
Image: | |
source: 'data/logo/kivy-icon-512.png' | |
allow_stretch: True | |
Screen: | |
name: '2' | |
TextInput: | |
font_size: '50sp' | |
text: "'kivy.garden.moretransitions' was updated recently." | |
BoxLayout: | |
id: boxlayout | |
size_hint_x: .3 | |
orientation: 'vertical' | |
''') | |
manager = root.ids.manager | |
boxlayout = root.ids.boxlayout | |
for transition in ALL_TRANSITIONS: | |
def on_press(button, _transition=transition): | |
manager.transition = _transition(duration=2) | |
manager.current = manager.next() | |
boxlayout.add_widget(Button(text=transition.__name__, | |
on_press=on_press)) | |
runTouchApp(root) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment