Created
June 29, 2021 22:43
-
-
Save tshirtman/97881c0a4ea3add2ab309e45224c4a9c to your computer and use it in GitHub Desktop.
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 App | |
from kivy.lang import Builder | |
from kivy.animation import Animation | |
KV = ''' | |
FloatLayout: | |
Button: | |
id: btn1 | |
size_hint: None, None | |
size: '100dp', '48dp' | |
text: 'hit me' | |
pos_hint: {'center': (.25, .5)} | |
on_press: | |
app.animate(btn2) | |
Button: | |
id: btn2 | |
size_hint: None, None | |
size: '100dp', '48dp' | |
text: 'or hit me' | |
pos_hint: {'center': (.75, .5)} | |
on_press: | |
app.animate(btn1) | |
''' | |
class Application(App): | |
def build(self): | |
return Builder.load_string(KV) | |
def animate(self, button): | |
button.disabled = True | |
anim = Animation(opacity=0, duration=0.2) | |
anim += Animation(opacity=0, duration=4.8) | |
anim += Animation(opacity=1, duration=0.2) | |
def enable(*args): | |
button.disabled = False | |
anim.bind(on_complete=enable) | |
anim.start(button) | |
def enable_play_button_again(self, dt): | |
print('Activating play button') | |
self.play_button.disabled = False | |
if __name__ == "__main__": | |
Application().run() |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment