def __init__(self,**kwargs): self.register_event_type('on_finish') self.register_event_type('on_answer') super(Exam, self).__init__(**kwargs) self.orientation="vertical" self.question_label=Label() self.chain_widget=Caterpillar() buttons=BoxLayout(orientation="horizontal") b=Button(text="Valid") b.background_color=(0,1,0,1) b.val=True b.bind(on_press=self.answer) buttons.add_widget(b) b=Button(text="Invalid") b.background_color=(1,0,0,1) b.val=False b.bind(on_press=self.answer) buttons.add_widget(b) self.add_widget(self.question_label) self.add_widget(self.chain_widget) self.add_widget(buttons)