0

I have a checkboxCtrlmixin, and what I want is to show the selected values of the checkboxCtrlmixin. Is there any special function in checkboxctrlmixin that shows what values are selected?

My code:

class TestListCtrl(wx.ListCtrl, listmix.CheckListCtrlMixin, listmix.ListCtrlAutoWidthMixin):
def __init__(self,*args,**kwargs):
wx.ListCtrl.__init__(self,*args,**kwargs)
listmix.CheckListCtrlMixin.__init__(self)
listmix.ListCtrlAutoWidthMixin.__init__(self)
self.setResizeColumn(3)


class rulesFrame(wx.Frame):##open about frame
""""""

#----------------------------------------------------------------------
def __init__(self):
    """Constructor"""
    wx.Frame.__init__(self, None, wx.ID_ANY, "Choose Rules")
panel = wx.Panel(self)##create panel
prules=subprocess.check_output("perl ruleFinder.pl dataset24819.arff rules_test1Fold0w4_sample00ll1.dat", shell=True)
prules = prules.split()
ruleiden = [x for x in prules if x!='159']
ruleiden = list(set(ruleiden))
sortrule = [int(x) for x in ruleiden]
sortrule.sort()
with open('rules_test1Fold0w4_sample00ll1.dat') as fileobj:
    lines = list(fileobj)
actualrules=''
##sortrule=[item+1 for item in sortrule]
##print sortrule
for index in sortrule:
    actualrules += lines[index]

actualrules = actualrules.split('\n')

wx.Button(panel,label="Show Selected Rules",pos=(170,520),size=(200,25))

self.list = TestListCtrl(panel,size=(1000,500), style = wx.LC_REPORT)

self.list.InsertColumn(0,'Rules')
self.list.SetColumnWidth(0,500)


for i in actualrules:

    self.list.InsertStringItem(sys.maxint,i)
4

1 回答 1

0

To find out if an item is checked use the following method of your listctrl

IsChecked(self, index)

which will return True/False for given index.

于 2013-03-31T01:02:57.247 回答