Created
May 6, 2019 01:05
-
-
Save Dirk-Sandberg/6405940fead0f730b0d9c58af105d69e 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.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