So i have a button called RunButton. When I press it I want it to change a button's background color from red to green when it hits the 3 second mark, in a 10 seconds range. This is how I do it:
self.RunButton.clicked.connect(self.run)
def run(self):
for i in range(10):
i += 1
print i
time.sleep(1)
if (i == 3):
self.B18.setStyleSheet("background-color: green")
Although, when i click the RunButton it prints the time as it goes by but the button B18 only changes color when the for loop reaches it's end, i.e., after 10 seconds, when it should have changed after 3.
So how do I make to change color mid loop, when it should be?