wxpython listbox multiselection

If you need the selection events when more 
than one item is selected, then you'll want to not use virtual mode.  If 
you just need to be able to find out what items are currently selected 
then you can use a loop like this: 

        item = listctrl.GetFirstSelected() 
        while item != -1: 
                # do something with the item 

                item = listctrl.GetNextSelected(item) 


When the ListCtrl is in virtual mode then it won't do anything that 
could possibly mean that every item in the list would be visited.  This 
includes sending an event for every item selected when a multiple 
selection is done.  To understand why this is the case try to imagine 
what would happen if you had an event handler for item selection and a 
virtual listctrl with 1 billion items, and you click the first item, 
scroll to the bottom and shift-click the last item.  Scrolling would be 
quick because it only needs to visit those items that need to be 
painted, but sending the selection events would take a week or so.  ;-) 

-- 
Robin Dunn 
Software Craftsman 



http://wxpython-users.1045709.n5.nabble.com/listctrl-and-multiple-selection-td2355984.html

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值