View Single Post
Old 08-09-2017, 02:29 PM   #22
nilodor
College Benchwarmer
 
Join Date: Oct 2000
Location: calgary, AB
Quick update:

So I screwed around with threads and was able to get something working so now my code is working in two sections:

The actual race bit:

Code:
def doRace(self, i): divy = 1000 self.progressBar.setProperty("value",xpos_100m(self.A,i/divy)) if xpos_100m(self.A,i/divy) >=100:self.label_17.setText(str(self.A.t100())) self.progressBar_2.setProperty("value",xpos_100m(self.B,i/divy)) if xpos_100m(self.B,i/divy) >=100:self.label_18.setText(str(self.B.t100())) self.progressBar_3.setProperty("value",xpos_100m(self.C,i/divy))

And a main thread

Code:
def runRace(self): for i in range (13000): bob = threading.Thread(target=self.doRace, args=(i,), daemon=True) #bob = threading.Timer(interval=0.001,target=self.doRace, args=(i,), daemon=True) bob.start()

Now you can see where I made my first attempt at using a timer. Which crashed my program, probably for good reason. But it's a win! I also think I'm probably violating how threads work.
nilodor is offline   Reply With Quote