Guest User

Untitled

a guest
Sep 22nd, 2017
96
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 1.44 KB | None | 0 0
  1. from kivy.base import runTouchApp
  2. from kivy.lang import Builder
  3. from kivy.uix.scrollview import ScrollView
  4. from kivy.app import App
  5. import random
  6. from kivy.uix.button import Button
  7. from kivy.garden.roulette import Roulette
  8. from kivy.garden.tickline import Tickline
  9.  
  10.  
  11. Builder.load_string("""
  12. #:import random random
  13. #:import Roulette kivy.garden.roulette
  14. <NewThing>:
  15.    BoxLayout:
  16.        Button:
  17.            text: 'sample testing'
  18.            background_color: [random.random(),random.random(),random.random(),.6]
  19.        Roulette
  20.        Label:
  21.            text: 'product text'
  22.  
  23.  
  24. <ScrollableLabel>:
  25.    BoxLayout:
  26.        orientation: 'vertical'
  27.        BoxLayout:
  28.            orientation: 'horizontal'
  29.            ClickMe:
  30.                text: 'add more!'
  31.                on_release: self.click(root)
  32.        NewThing
  33.  
  34.        NewThing
  35.  
  36.  
  37. """)
  38.  
  39. productlist = ['apple','2']
  40.  
  41. class ClickMe(Button):
  42.     def __init__(self, **kwargs):
  43.         super(ClickMe, self).__init__(**kwargs)
  44.  
  45.     def click(self, rootwidget):
  46.  
  47.         # rootwidget.add_widget(NewThing())
  48.         print self.parent.parent.add_widget(NewThing())
  49.  
  50.  
  51.        
  52.  
  53. class NewThing(ScrollView):
  54.     def __init__(self, **kwargs):
  55.         super(NewThing, self).__init__(**kwargs)
  56.     pass
  57.  
  58. class ScrollableLabel(ScrollView):
  59.     def __init__(self, **kwargs):
  60.         super(ScrollableLabel, self).__init__(**kwargs)
  61.    
  62.  
  63. runTouchApp(ScrollableLabel())
Advertisement
Add Comment
Please, Sign In to add comment