1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35
| class Calcul(QtCore.QThread):
def __init__(self):
QtCore.QThread.__init__(self)
def __del__(self):
self.wait()
def run(self):
while True:
combinaison_trouvee = 1
nbPesonsStables = 12
items = []
data = []
for id_peson in range(1,13):
if int(ui.MainPage_GroupPesons.findChild(QtGui.QLineEdit,"MainPage_Poids" + str(id_peson)).text()) == 0:
if nbPesonsStables == 11:
combinaison_trouvee = 0
break
else:
nbPesonsStables -=1
else: # Si la valeur du peson est > 0 alors on integre les valeurs dans les tableaux
items.append(id_peson)
data.append(int(ui.MainPage_GroupPesons.findChild(QtGui.QLineEdit,"MainPage_Poids" + str(id_peson)).text()))
if combinaison_trouvee == 1:
result=[(combi,len(da),sum(da),min(da),max(da))
for nbCombi in range(NbMini,NbMaxi +1)
for combi,da in zip(ite.combinations(items, nbCombi),ite.combinations(data, nbCombi))]
df=pd.DataFrame(result,columns=["Combinaison","Nb","Poids","Min","Max"])
print(df)
app.processEvents() |
Partager