In this video I’ll show you how to add a map to your Kivy App.
We’ll use MapView to add a map to our Kivy app two different ways; on the Python file, and on the Kivy file.
Adding maps to our kivy app with MapView is super easy. It allows you to pinpoint locations by Latitude and Longitude.
#kivy #codemy
Python Code: map.py
GitHub Code: map.py
from kivymd.app import MDApp from kivy_garden.mapview import MapView class MapViewApp(MDApp): def build(self): mapview = MapView(zoom=10, lat=36, lon=-115) return mapview MapViewApp().run()
Python Code: map2.py
GitHub Code: map2.py
from kivy.lang import Builder from kivymd.app import MDApp class MainApp(MDApp): def build(self): self.theme_cls.theme_style = "Dark" self.theme_cls.primary_palette = "BlueGray" return Builder.load_file('map2.kv') MainApp().run()
Kivy Design Code: map2.kv
GitHub Code: map2.kv
#:import MapView kivy.garden.mapview.MapView MapView: lat: 36 lon: -115 zoom: 10
Add comment