2016-02-07 31 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!

相關問題