Skip to content

Instantly share code, notes, and snippets.

@Dirk-Sandberg
Created May 6, 2019 01:05
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 Dirk-Sandberg/6405940fead0f730b0d9c58af105d69e to your computer and use it in GitHub Desktop.
Save Dirk-Sandberg/6405940fead0f730b0d9c58af105d69e to your computer and use it in GitHub Desktop.
from kivy.app import App
from kivy.lang import Builder
from kivy.clock import Clock
from kivy.animation import Animation
from kivy.garden.mapview import MapView
print("A")
# Animate moving around on a map
kv = """
FloatLayout:
MapView:
id: animated_widget
lat: 32
lon: -110
zoom: 10
on_lat:
self.center_on(self.lat, self.lon)
on_lon:
self.center_on(self.lat, self.lon)
"""
kv = Builder.load_string(kv)
class MainApp(App):
def build(self):
return kv
def on_start(self):
Clock.schedule_interval(self.animate, 2)
def animate(self, *args):
mapview = self.root.ids.animated_widget
old_lon = mapview.lon
print(old_lon)
anim = Animation(lon=old_lon-.5)
anim.start(self.root.ids.animated_widget)
MainApp().run()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment