예제 #1
0
 def _get_checklist_widget_check(self, question, i):
     multiple_responses = BoxLayout(orientation='vertical',
                                    id='Response ' + i,
                                    size_hint_y=None,
                                    height=(len(question.answer) * 70),
                                    spacing=20)
     for key, value in question.answer.items():
         response = BoxLayout(orientation='horizontal',
                              id='sub Response ' + i)
         response.add_widget(Label(text=key, id=key))
         if key.lower().startswith('other'):
             widget = TextInput(id=key, size_hint_x=.8)
             if isinstance(value, (str, unicode)):
                 widget.text = value
         else:
             widget = CheckBox(id=key)
             widget.active = value
         response.add_widget(widget)
         multiple_responses.add_widget(response)
     return multiple_responses