lundi 27 mai 2019

Accessing values from checkboxes list passes in a function

I have created a list of checkboxes. When i click on a checkbox the values of all the checkboxes pass through the function instead of the checked one.

def vendorData(self, recs, rowide):

    self.chkVendorValue = "vendor"+rowide
    self.refEntryText = "ref" + rowide
    self.titleEntryText = "title" + rowide
    self.isbnEntryText = "isbn" + rowide
    self.qtyEntryText = "qty" + rowide
    currpoinfo = str(recs[4]) + "_" + str(recs[1])
    self.arrSelect[self.arrMatrixHead[self.i]] = Checkbutton(self.InsideFrame, variable=self.chkVendorValue, onvalue=1,
                        offvalue=0, font=config.allLabels(), justify=LEFT, command = self.chkSelected(currpoinfo))

    self.arrSelect[self.arrMatrixHead[self.i]].pack()
    self.arrSelect[self.arrMatrixHead[self.i]].place(x=config.xrow, y=config.ycol, width=20, height=25)

#---------------------------Description Module------------------------------- def chkSelected(self, porefid): #print("chkvalue: ", self.chkVendorValue)

    print("porefid", porefid)
    if porefid != "0" and porefid != "":
        poinfo =  porefid.split("_",2)

chkvalue: vendorrow0 porefid 2_9780306407062 chkvalue: vendorrow1 porefid 2_9781552096246 chkvalue: vendorrow2 porefid 1_9781849733816 I wanted only one pair of values instead of 3.




Aucun commentaire:

Enregistrer un commentaire