When I run my script:
def rate(self, activeCount): activeRate = (activeCount/64)/1.5 #function of activeRate here round(activeRate, 3) self.incRate.setText(f' {activeRate}/min')
I can’t seem to get this rounding feature to show up in my GUI, however I know the function works when printed. Does anyone know why this is not visuallizing to my GUI in pyqt5? The QLabel is named incRate.
Advertisement
Answer
round
is not an “in-place” conversion.
Use activeRate = round(activeRate, 3)
, or directly use the format syntax, which uses the same implementation as round
:
self.incRate.setText(f' {activeRate:.3f}/min')