def openSimple(self): a,b,c,x0=self.readSimpleVar() lp=randomcalc.findsimplelp(a,b,c,x0) ln=randomcalc.findsimpleln(a,b,c,x0,lp) data=randomcalc.calculatesimple(lp+ln+1,a,b,c,x0) plt.bar(range(1,1+len(data)), data, align='center', color=['yellow']*ln+['green']*(len(data)-ln-1)+['red']) plt.show()
def calculateSimple(self): a,b,c,x0=self.readSimpleVar() lp=randomcalc.findsimplelp(a,b,c,x0) ln=randomcalc.findsimpleln(a,b,c,x0,lp) s,q=randomcalc.simplequality(a,b,c,x0) 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.calculatesimple(lp+ln+1,a,b,c,x0),n=ln)