Advertisement
Guest User

Untitled

a guest
Jan 18th, 2020
100
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.91 KB | None | 0 0
  1. from kivy.animation import Animation
  2. from kivy.app import App
  3. from kivy.clock import Clock
  4. from kivy.core.window import Window
  5. from kivy.uix.boxlayout import BoxLayout
  6. from kivy.uix.button import Button
  7. from kivy.uix.floatlayout import FloatLayout
  8. from kivy.uix.label import Label
  9. from kivy.uix.widget import Widget
  10. from kivy.uix.popup import Popup
  11.  
  12. from kivy.garden.mapview import MapView
  13. from kivy.garden.mapview import MapMarkerPopup
  14.  
  15.  
  16. from plyer import gps
  17.  
  18.  
  19. class Achievements(FloatLayout):
  20.     pass
  21.  
  22. class MainApp(App):
  23.  
  24.     @property
  25.     def build(self):
  26.         self.flag = False
  27.  
  28.         self.clock = Clock.schedule_once(self.open_anim, .2)
  29.         self.clock.cancel()
  30.         self.clock2 = Clock.schedule_once(self.open_anim2, .2)
  31.         self.clock2.cancel()
  32.  
  33.         self.box = FloatLayout()
  34.         map = MapView(zoom=12, lat=58.5224, lon=31.2832)
  35.         self.box.add_widget(map)
  36.        
  37.  
  38.         self.box_layer = FloatLayout()
  39.         marker = MapMarkerPopup(lat=58.51923, lon=31.27738)
  40.         self.box_layer.add_widget(marker)
  41.         self.box.add_widget(self.box_layer)
  42.  
  43.         # self.achievements = BoxLayout(size=(Window.width - 50, Window.height-50), pos_hint=)
  44.  
  45.  
  46.  
  47.         self.bl = BoxLayout(orientation='vertical', size_hint=(None, None), size=(100, Window.height), pos=(-210, 0), spacing= 20, padding =[0, 50])
  48.         self.bl.add_widget(Button(text='search'))
  49.         self.bl.add_widget(Button(text='settings'))
  50.         self.bl.add_widget(Button(text='achievements', on_press=self.MenuPopup()))
  51.         self.bl.add_widget(Button(text='mail us'))
  52.         self.bl.add_widget(Label(text='etc'))
  53.         self.box.add_widget(self.bl)
  54.  
  55.         self.box.add_widget(Button(text='menu',
  56.                                    on_press=self.pressing,
  57.                                    pos=(Window.width - 50, Window.height - 50), size_hint=(None, None), size=(50, 50)))
  58.  
  59.         return self.box
  60.  
  61.  
  62.  
  63.  
  64.     def pressing(self, instance):  # триггер
  65.         if self.flag == False:
  66.             self.clock()
  67.         if self.flag:
  68.             self.clock2()
  69.  
  70.     def open_anim(self, dt):  # анимация появления меню
  71.         anim = Animation(pos=(0, 0), t='out_elastic', duration=.5)
  72.         anim.start(self.bl)
  73.         self.flag = True
  74.  
  75.     def open_anim2(self, dt):  # анимация исчезновения меню
  76.         anim = Animation(pos=(-210, 0), t='out_elastic', duration=.5)
  77.         anim.start(self.bl)
  78.         self.flag = False
  79.  
  80.     def MenuPopup(self):
  81.         show = Achievements()
  82.  
  83.         popupWindow = Popup(title="Your achievements", content=Achievements, size_hint=(None, None), size=(400, 400))
  84.  
  85.         popupWindow.open()
  86.  
  87. # def on_start(self):
  88. # gps.configure(on_location=self.on_gps_location)
  89. # gps.start()
  90.  
  91. # def on_gps_location(self, **kwargs):
  92. # kwargs['lat'] = 10.0
  93. # kwargs['lon'] = 10.0
  94. # print(kwargs)
  95.  
  96.  
  97. MainApp().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement