jeudi 25 janvier 2018

Kivy: Touch the label to check the checkbox

I am trying to make an aap for MCQ's. Here i want a function, if anyone even click on the label corresponding to a checkbox, that check box must also be checked.. Is it possible in Kivy? Because Kivy doesn't provide any text association with checkbox directly.

Here is a portion of kv.

<MCQCheckBox@CheckBox>:
    color:0,0,0,1
    size_hint: 0.15, 1
    group: 'opts'

<MCQLabel@Label>:
    text_size: self.size
    valign: 'center'
    font_size: '13sp'
    color: 0,0,0,1

<MCQsGUI>:
   BoxLayout:
        orientation:'vertical'
        size_hint: 0.95, 0.7
        spacing: 2
        pos_hint: {'center_x': .5, 'center_y': .5}

    MCQBoxLayout:
        MCQCheckBox:
        MCQLabel:
            text:"option 1"
    MCQBoxLayout:
        MCQCheckBox:
        MCQLabel:
            text:"option 2"
    MCQBoxLayout:
        MCQCheckBox:
        MCQLabel:
            text:"option 3"
    MCQBoxLayout:
        MCQCheckBox:
        MCQLabel:
            text:"option 4"




Aucun commentaire:

Enregistrer un commentaire