我的 main.py 代码
class StageBox(BoxLayout):
text = StringProperty()
class MainApp(App):
stageList = ('item1', 'item2','item3') #BUT THERE WILL BE MORE
def build(self):
Window.clearcolor = (.80,.80,.80,1)
Window.size = (1350, 780)
# HEADER PART (NON SCROLLABLE)
TABLE = BoxLayout(orientation = 'vertical', spacing = 4, padding = 10)
HEADER = BoxLayout(orientation = 'horizontal', size_hint = [1,.08], spacing = 2)
HEADER.add_widget(Cell(text='HOURS', size_hint = [.045,1]))
HEADER.add_widget(Cell(text='STAGE', size_hint = [.09,1]))
DataBox = BoxLayout(orientation = 'vertical', spacing = 2)
DataBox.add_widget(Cell(text = 'June'.upper()))
DaysBox = BoxLayout(orientation = 'horizontal', spacing = 1)
for i in range(1,31):
DaysBox.add_widget(Cell(text = str(i)))
DataBox.add_widget(DaysBox)
HEADER.add_widget(DataBox)
TABLE.add_widget(HEADER)
# BODY PART SCROLLABLE !
scroll = RV()
BODY = BoxLayout(orientation = 'vertical',spacing = 4)
for item in self.stageList:
SB = StageBox()
Boxy = SB.ids.HoursBox
for i in range(1,13):
Boxy.add_widget(Cell(text=str(i)))
Grid = SB.ids.GridBox
for i in range(1,361):
Grid.add_widget(Button(text='', background_color = self.whiteColor, background_normal = ''))
Stage = SB.ids.StageCell
Stage.text = item
BODY.add_widget(SB)
TABLE.add_widget(BODY)
return TABLE
if __name__ == "__main__":
MainApp().run()