Advertisement
Guest User

Untitled

a guest
Jun 29th, 2015
181
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.49 KB | None | 0 0
  1. import kivy
  2. from kivy.app import App
  3. from kivy.uix.label import Label
  4. from kivy.lang import Builder
  5. from kivy.uix.screenmanager import ScreenManager, Screen, FadeTransition
  6. from kivy.uix.floatlayout import FloatLayout
  7. from kivy.uix.boxlayout import BoxLayout
  8. from kivy.uix.anchorlayout import AnchorLayout
  9. from kivy.uix.gridlayout import GridLayout
  10. from kivy.uix.stacklayout import StackLayout
  11. from kivy.uix.scrollview import ScrollView
  12. from kivy.graphics import Rectangle, Color
  13.  
  14.  
  15. class UpLabel(Label):
  16. pass
  17.  
  18. class UpStack(StackLayout):
  19. pass
  20. class UpFloat(FloatLayout):
  21. pass
  22.  
  23. class Main(App):
  24. def build(self):
  25. StackList = CreateUpdate(ActualUpdates)
  26. print StackList
  27. Stack = UpStack(pos_hint= {'center_x':0.5, 'center_y':0.5},
  28. spacing=10)
  29. for i in range(0, len(StackList)):
  30. # MyFloats.append(UpFloat())
  31. # MyFloats[i].add_widget(StackList[i])
  32. Stack.add_widget(StackList[i])
  33.  
  34. return Stack
  35.  
  36. ActualUpdates = ['This is an update',
  37. 'This is also an update',
  38. 'this is the third updates',
  39. 'boo Yeah!, Longer list of updates!',
  40. 'Jan 26: Updates are updated',
  41. 'Thank our Lord and savior for updates',
  42. 'Peter would like this update',
  43. 'This is a good update']
  44.  
  45. def CreateUpdate(LOS):
  46. MyStack = []
  47. MyLabs = []
  48. MyFloat = []
  49. for i in range(0, len(LOS)):
  50.  
  51. MyLabs.append(UpLabel(text=LOS[i]))
  52. MyStack.append(UpStack(pos_hint= {'center_x':0.5, 'center_y':0.5},
  53. spacing=0,
  54. color=(0,1,1)))
  55. MyFloat.append(UpFloat())
  56.  
  57. MyStack[i].add_widget(UpLabel(text='UPDATE'))
  58. MyStack[i].add_widget(MyLabs[i])
  59. MyFloat[i].add_widget(MyStack[i])
  60.  
  61. return MyFloat
  62.  
  63.  
  64.  
  65.  
  66. root = Builder.load_string('''
  67.  
  68. <UpLabel>:
  69. size_hint: None, None
  70. width: self.texture_size[0] + dp(12)
  71. height: self.texture_size[1]
  72.  
  73. <UpStack>:
  74. orientation: 'lr-tb'
  75. size_hint: None, None
  76. height: self.minimum_height
  77. width: 1
  78.  
  79. <UpFloat>:
  80. size_hint: 10, 10
  81. canvas:
  82. Color:
  83. rgba: (0, 0, 1, 1.)
  84. Rectangle:
  85. size: self.size
  86. pos: self.pos
  87.  
  88.  
  89.  
  90.  
  91. ''')
  92.  
  93. if __name__ == "__main__":
  94. Main().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement