Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- from kivy.app import App
- from kivy.lang import Builder
- from kivy.uix.screenmanager import ScreenManager, Screen
- from kivy.properties import NumericProperty
- from kivy.uix.widget import Widget
- from time import sleep
- kv = """
- Tela_Programar:
- FloatLayout:
- size_hint:(None,None)
- size:800,700
- canvas.before:
- Color:
- rgba:0,0,0,1
- Rectangle:
- size:self.size
- pos:self.pos
- Button:
- text:'ENTER'
- color:1,1,1,1
- font_size:'20sp'
- size_hint:(None,None)
- size:(100,30)
- on_press:root.Criar_list()
- x:300
- y:80
- Button:
- id:eu
- text:'Eu '
- color:1,1,1,1
- font_size:'20sp'
- size_hint:(None,None)
- size:(100,30)
- x:300
- y:500
- Button:
- id:gosto
- text:'Gosto'
- color:1,1,1,1
- font_size:'20sp'
- size_hint:(None,None)
- size:(100,30)
- x:300
- y:400
- Button:
- id:praia
- text:'Praia'
- color:1,1,1,1
- font_size:'20sp'
- size_hint:(None,None)
- size:(100,30)
- x:300
- y:300
- """
- class Tela_Programar(Screen):
- def __init__(self, **kwargs):
- super(Tela_Programar, self).__init__(**kwargs)
- self.lop = [[]]
- self.Ld = None
- self.Le = None
- def criar_lista(self):
- self.cta = 0
- Qtc = 10
- self.lop[:] = []
- zero = 300
- while self.cta < Qtc:
- self.cta += 1
- for lo in range(1, 3):
- if lo == 1:
- self.lop.append(['Ld', zero + 200, zero + 200, zero + 200])
- else:
- self.lop.append(['Le', zero - 200, zero - 200, zero - 200])
- # Apresentação
- Aa = 0
- Ld = str('Ld')
- Le = str('Le')
- for xa in self.lop:
- ix = self.lop[Aa][0]
- for ax in range(2):
- if ix == Ld:
- # desloca lado direito
- self.ids.eu.x = self.lop[Aa][1]
- self.ids.gosto.x = self.lop[Aa][2]
- self.ids.praia.x = self.lop[Aa][3]
- sleep(0.1)
- print('xa=', xa, 'ix=', ix, 'Ld=', Ld, 'Aa=', Aa)
- else:
- # desloca lado esquerdo
- self.ids.eu.x = self.lop[Aa][1]
- self.ids.gosto.x = self.lop[Aa][2]
- self.ids.praia.x = self.lop[Aa][3]
- sleep(0.2)
- Aa += 1
- class Duvida_List(App):
- def build(self):
- return Builder.load_string(kv)
- Duvida_List().run()
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement