何处将选择更改绑定到.kv

时间:2017-01-19 15:11:01

标签: kivy kivy-language

在以下kv部分:

TabbedPanelItem:
        id: tab2
        text: 'VIEW'
        on_press: root.viewInit()
        ListView:
            id: view_list
            adapter: 
                ListAdapter(
                data= root.valid_views,
                selection_mode='multiple',
                allow_empty_selection=True,
                cls=ListItemButton)

我在哪里插入on_selection_change: root.somefunc()来绑定并捕获ListAdapter中的选择更改事件?

1 个答案:

答案 0 :(得分:0)

TabbedPanelItem:
        id: tab2
        text: 'VIEW'
        on_press: root.viewInit()
        ListView:
            id: view_list
            adapter: 
                ListAdapter(
                data= root.valid_views,
                selection_mode='multiple',
                allow_empty_selection=True,
                cls=ListItemButton,
                on_selection_change = root.somefunc())