コード例 #1
0
ファイル: main.py プロジェクト: BetaRavener/GLSTN
    def __init__(self, listOfChoices, pick_action, **kwargs):
        result = super(DropDownPicker, self).__init__(**kwargs)

        self._pick_action = pick_action
        pickerList = DropDown()

        for item in listOfChoices:
            choiceButton = Button(text=item, size_hint_y=None, height=50)
            choiceButton.bind(on_release=lambda btn: pickerList.select(btn.text))
            pickerList.add_widget(choiceButton)

        self.bind(on_release=pickerList.open)
        pickerList.bind(on_select=lambda instance, x: self._after_pick(x))

        pickerList.size_hint = (None, 0.4)

        return result