简体   繁体   中英

Pyqt5 QLCDNumber is not showing seconds (third object)

I have a QLCDNumber I need to show 3 parts (hrs:minutes:seconds). So, I set it as lcdnumber.display("00:00:00") , it show only two parts (00:00). I think the problem is with ":". I tried to separate and use text manipulation, it didn't work, only shows the first two parts. How can I show the third part of seconds.

You have to set the number of digits you want to display using the digitCount property, in this case it must be 8 (6 for the zeros and 2 for ":"):

from PyQt5 import QtWidgets

if __name__ == "__main__":
    app = QtWidgets.QApplication([])

    w = QtWidgets.QLCDNumber()
    w.setDigitCount(8)
    w.display("00:00:00")
    w.resize(640, 120)
    w.show()

    app.exec_()

在此处输入图像描述

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM