def openHard(self): a,b,c,d,x0,x1=self.readHardVar() lp=randomcalc.findhardlp(a,b,c,d,x0,x1) ln=randomcalc.findhardln(a,b,c,d,x0,x1,lp) data=randomcalc.calculatehard(lp+ln+1,a,b,c,d,x0,x1) plt.bar(range(1,1+len(data)), data, align='center', color=['yellow']*ln+['green']*(len(data)-ln-1)+['red']) plt.show()
def calculateHard(self): a,b,c,d,x0,x1=self.readHardVar() lp=randomcalc.findhardlp(a,b,c,d,x0,x1) ln=randomcalc.findhardln(a,b,c,d,x0,x1,lp) s,q=randomcalc.hardquality(a,b,c,d,x0,x1) self.ln_text.setText('<b>'+str(ln)+'</b>') self.lp_text.setText('<b>'+str(lp)+'</b>') self.q_text.setText('<b>'+str(s)+'</b>') print(lp,ln,s,q) with xkcd(): self.quality_bar.redraw(q,ml1=True) if self.draw_data_btn.isChecked(): self.data_bar.redraw(randomcalc.calculatehard(lp+ln+1,a,b,c,d,x0,x1),n=ln)