I am new to python and I am trying to learn simpy and pyqt5. I am making some program in which I want to change the label color at every iteration but I dont know why It shows only 1 color.
To change the color first i mention green color then black but after starting program it only shows black. Is there any way to change the color continuously.
def carParking(env, name, ps, depart_time, parking_Duration):
yield env.timeout(depart_time)
print("Car %d arrived on station at %d" % (name, env.now))
app.processEvents()
dlg.parkedCars.display(name)
app.processEvents()
dlg.lEnter.setStyleSheet('color: Green')
dlg.lEnter.setStyleSheet('color: Black')
dlg.lEnter.setStyleSheet('color: Green')
time.sleep(0.30)
with ps.request() as req:
yield req
time.sleep(0.30)
print("%d parked at %s" % (name, env.now))
yield env.timeout(parking_Duration)
time.sleep(0.30)
print("%d leaving the Parking Station at %s" % (name, env.now))
dlg.lExit.setStyleSheet('color: Red')
In above code You can see the color green black green but it doesnt work like that. It only shows only one color which is green. The remaining code is given below
env = simpy.Environment()
ps = simpy.Resource(env, capacity=5)
def syslot(self):
#a=dlg.parkingSpace.setText(str(float(dlg.nCars.text())))
ab=int(dlg.nCars.text())
for i in range(ab):
a = randint(1, 5)
# dlg.lEnter.setStyleSheet('color: black')
# dlg.lExit.setStyleSheet('color: black')
env.process(carParking(env, i, ps, i * 2, a))
time.sleep(0.10)
print("The parking duration of Car %d is %d" % (i, a))
env.run()
app =QtWidgets.QApplication([])
dlg = uic.loadUi("design.ui")
dlg.visualize.clicked.connect(syslot)
dlg.show()
sys.exit(app.exec_())
Please tell me what should I do to change the label color continuously. Thank you in advance.