Skip to content

Instantly share code, notes, and snippets.

@tshirtman
Last active April 5, 2021 12:29
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save tshirtman/caa7ade03e48bd84f7629b69d8a1240e to your computer and use it in GitHub Desktop.
Save tshirtman/caa7ade03e48bd84f7629b69d8a1240e to your computer and use it in GitHub Desktop.
'''
'''
from kivy.app import App
from kivy.lang import Builder
from kivy.clock import Clock
import kivy.properties as P
KV = '''
#:import Animation kivy.animation.Animation
<Loading@Widget>:
angle: (app.time * 360) % 360
radius: self.width
canvas:
Color:
rgba: rgba('#FF4444')
Line:
width: 9
ellipse: self.x, self.y, self.radius or 0, self.radius or 0, self.angle or 0, (self.angle or 0) + 90
Line:
width: 9
ellipse: self.x, self.y, self.radius or 0, self.radius or 0, (self.angle or 0) + 180, (self.angle or 0) + 180 + 90
SmoothLine:
width: 10
ellipse: self.x, self.y, self.radius or 0, self.radius or 0, self.angle or 0, (self.angle or 0) + 90
SmoothLine:
width: 10
ellipse: self.x, self.y, self.radius or 0, self.radius or 0, (self.angle or 0) + 180, (self.angle or 0) + 180 + 90
FloatLayout:
Loading:
id: loading
size_hint: None, None
pos_hint: {'center': (.5, .8)}
opacity: 0
ToggleButton:
size_hint: None, None
pos_hint: {'center': (.5, .3)}
on_state:
Animation.cancel_all(loading, 'opacity')
Animation(opacity=1 if self.state == 'down' else 0).start(loading)
'''
class Application(App):
time = P.NumericProperty()
def build(self):
Clock.schedule_interval(self.update_time, 0)
return Builder.load_string(KV)
def update_time(self, dt):
self.time += dt
if __name__ == "__main__":
Application().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment