我试图制作类似菜单的应用。我已经使用gridLayout进行了scrollview,但我不知道如何将这个单独显示,例如,在左列名称中,以及在右列时代,这样app可能具有可变行数(无穷大) )。我希望尽可能少混淆,我的英语也一样。谢谢大家,我没有在这里发布我的代码因为我认为没有必要。再见,祝你有个美好的一天。
答案 0 :(得分: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'
我希望我能在这段时间内成功(发布我的代码)。非常感谢!