two screens, one of them with a map that has a centered marker on it
This commit is contained in:
parent
318d1ae9b7
commit
e0af3de69c
33
flockompass.kv
Normal file
33
flockompass.kv
Normal file
@ -0,0 +1,33 @@
|
|||||||
|
#:import random random.random
|
||||||
|
#:import RiseInTransition kivy.uix.screenmanager.RiseInTransition
|
||||||
|
|
||||||
|
<MapScreen>:
|
||||||
|
BoxLayout:
|
||||||
|
Button:
|
||||||
|
text: 'Goto settings'
|
||||||
|
on_press: root.manager.current = 'compass'
|
||||||
|
|
||||||
|
MapView:
|
||||||
|
id: mapview
|
||||||
|
lat: 28.89335172
|
||||||
|
lon: 76.59449171
|
||||||
|
zoom: 15
|
||||||
|
|
||||||
|
on_map_relocated: centermark.lat = mapview.lat; centermark.lon = mapview.lon
|
||||||
|
|
||||||
|
MapMarker:
|
||||||
|
id: centermark
|
||||||
|
anchor_x: 0.2
|
||||||
|
anchor_y: 0.3
|
||||||
|
lat: 28.89335172
|
||||||
|
lon: 76.59449171
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
<CompassScreen>:
|
||||||
|
BoxLayout:
|
||||||
|
Button:
|
||||||
|
text: 'My settings button'
|
||||||
|
Button:
|
||||||
|
text: 'Back to menu'
|
||||||
|
on_press: root.manager.current = 'map'
|
||||||
41
main.py
Normal file
41
main.py
Normal file
@ -0,0 +1,41 @@
|
|||||||
|
from kivy.app import App
|
||||||
|
from kivy.uix.screenmanager import ScreenManager, Screen, RiseInTransition
|
||||||
|
from kivy.properties import NumericProperty
|
||||||
|
from kivy.lang import Builder
|
||||||
|
from kivy_garden.mapview import MapView
|
||||||
|
|
||||||
|
|
||||||
|
class MapScreen(Screen):
|
||||||
|
hue = NumericProperty(0)
|
||||||
|
mapview = MapView(zoom=11, lat=50.6394, lon=3.057)
|
||||||
|
|
||||||
|
|
||||||
|
class CompassScreen(Screen):
|
||||||
|
hue = NumericProperty(0)
|
||||||
|
|
||||||
|
|
||||||
|
class FlockompassApp(App):
|
||||||
|
|
||||||
|
def build(self):
|
||||||
|
|
||||||
|
root = ScreenManager(transition=RiseInTransition())
|
||||||
|
root.add_widget(MapScreen(name='map'))
|
||||||
|
root.add_widget(CompassScreen(name='compass'))
|
||||||
|
|
||||||
|
return root
|
||||||
|
|
||||||
|
|
||||||
|
if __name__ == '__main__':
|
||||||
|
FlockompassApp().run()
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
|
# Button:
|
||||||
|
# text: 'Use FallOutTransition'
|
||||||
|
# on_release: root.manager.transition = FallOutTransition()
|
||||||
|
|
||||||
|
# Button:
|
||||||
|
# text: 'Use RiseInTransition'
|
||||||
|
# on_release: root.manager.transition = RiseInTransition()
|
||||||
|
|
||||||
Loading…
Reference in New Issue
Block a user