2016-02-07 32 views
-2

我正在尝试使应用程序类似于一个菜单。我已经使用gridLayout进行了scrollview,但是我不知道如何在左列名称和右列时代中单独显示,这样应用可能会有可变数量的行(无穷大)。我希望我尽可能少混淆,我的英语也一样。谢谢大家,我没有在这里发布我的代码,因为我认为这不是必要的。再见,祝你有美好的一天。kivy(GridLayout)中的每行单个单词

+1

你* definetly *应该告诉我们你到目前为止尝试过的。 – Chris

回答

0
Ass is important I post my code here, I'm going to try to post. I'm sorry for the mistakes like indent. 

.py 
    class PrimeiroScreen(Screen): 
    def __init__(self, **kwargs): 
     self.name = 'home' 
     super(Screen,self).__init__(**kwargs) 
class SegundoScreen(Screen): 
    text = StringProperty('') 
    def __init__(self, **kwargs): 
     self.name = 'dois' 
     super(Screen,self).__init__(**kwargs) 
class RootScreen(ScreenManager): 
    pass 
class scrollmanageApp(App): 
    def build(self): 
     return RootScreen() 
if __name__ == '__main__': 
    appVar = scrollmanageApp() 
    scrollmanageApp().run() 

.kv

<RootScreen>: 
    PrimeiroScreen: 
    SegundoScreen: 

<PrimeiroScreen>: 
    BoxLayout: 
     size_hint: (.3,.15) 
     pos_hint:{'x': .35, 'y': .84} 
     Label: 
      text: "Teste de união scrollview com screenmanage" 
      font_size: '30dp' 
    GridLayout: 
     cols: 1 
     rows: 2 
     size_hint: (.20,.10) 
     pos_hint:{'x': .25, 'y': .64}  
     Button: 
      text: "Scrollview!" 
      font_size: '30dp' 
      text_size: self.size 
      on_press: root.manager.current = 'dois' 

<SegundoScreen>: 
    text: 'This is just a test ' * 50 
    ScrollView: 
     size_hint: 1, 1 
     pos_hint:{'x': .0, 'y': .0} 
     size: 100, 100 
     GridLayout: 
      cols: 2 
      #rows: 
      padding: 10 
      spacing: 10 
      size_hint: None, None 
      width: 500 
      height: self.minimum_height 
      Label: 
       text: root.text 
       font_size: 50 
       text_size: self.width, None 
       size_hint_y: None 
       height: self.texture_size[1] 

    Button: 
     text: "Voltar!" 
     size_hint: .1, .1 
     pos_hint:{'x': .9, 'y': .0} 
     text_size: self.width, None 
     on_press: root.manager.current = 'home' 

我希望在这段时间(后我的代码)。非常感谢有sucess!

相关问题