Advertisement
Guest User

Untitled

a guest
May 21st, 2018
67
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.35 KB | None | 0 0
  1. from kivy.config import Config
  2. Config.set('graphics','fullscreen','auto')
  3.  
  4. from kivy.uix.label import Label
  5. from kivy.uix.image import Image
  6. from kivy.uix.boxlayout import BoxLayout
  7. from kivy.uix.scatterlayout import ScatterLayout
  8.  
  9. from kivy.lang import Builder
  10. from kivy.base import runTouchApp
  11.  
  12. Builder.load_string('''
  13. <RootLayout>:
  14. orientation: 'horizontal'
  15.  
  16. shipPath: []
  17.  
  18. ScatterLayout:
  19. auto_bring_to_front: False
  20. Image:
  21. id: blabla
  22. size_hint: (1.0,1.0)
  23. source: "myocean3.png"
  24.  
  25. canvas.after:
  26. Line:
  27. points: root.shipPath
  28.  
  29. BoxLayout:
  30. size_hint: (0.25, 1.0)
  31. orientation: 'vertical'
  32. canvas.before:
  33. Color:
  34. rgb: .0, .0, .0
  35. Rectangle:
  36. pos: self.pos
  37. size: self.size
  38.  
  39. padding: 20
  40. spacing: 20
  41. Button:
  42. text: 'Ship Route'
  43. on_press: root.setShipPath()
  44. Button:
  45. text: 'button2'
  46. Button:
  47. text: 'button3'
  48. Button:
  49. text: 'button4'
  50. ''')
  51.  
  52. class RootLayout(BoxLayout):
  53. shipPath = []
  54.  
  55. def setShipPath(self):
  56. self.shipPath = [100, 100, 200, 300, 400, 600]
  57. print self.shipPath
  58.  
  59.  
  60. runTouchApp(RootLayout())
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement