Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8643409
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 12, 20262026-06-12T12:01:43+00:00 2026-06-12T12:01:43+00:00

I just want to display system clock time in LCD format. I also want

  • 0

I just want to display system clock time in LCD format. I also want the time to be displayed using hh:mm:ss format. My code is below. But when I run it, it is not as I expected. Can anyone explain why?

import sys
from PySide import QtGui, QtCore

class Example(QtGui.QWidget):

    def __init__(self):
        super(Example, self).__init__()
        self.initUI()
        timer = QtCore.QTimer(self)
        timer.timeout.connect(self.showlcd)
        timer.start(1000)
        self.showlcd()

    def initUI(self):

        self.lcd = QtGui.QLCDNumber(self)
        self.setGeometry(30, 30, 800, 600)
        self.setWindowTitle('Time')

        vbox = QtGui.QVBoxLayout()
        vbox.addWidget(self.lcd)
        self.setLayout(vbox)

        self.show()

    def showlcd(self):
        time = QtCore.QTime.currentTime()
        text = time.toString('hh:mm:ss')
        self.lcd.display(text)


def main():

    app = QtGui.QApplication(sys.argv)
    ex = Example()
    sys.exit(app.exec_())


if __name__ == '__main__':
    main()
  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-12T12:01:45+00:00Added an answer on June 12, 2026 at 12:01 pm

    QLCDNumber has a fixed digit display (QLCDNumber.digitCount) and its default value is 5. So your text is truncated to the last 5 characters. You should set an appropriate value (8 in your case).

    import sys
    from PySide import QtGui, QtCore
    
    class Example(QtGui.QWidget):
    
        def __init__(self):
            super(Example, self).__init__()
            self.initUI()
            timer = QtCore.QTimer(self)
            timer.timeout.connect(self.showlcd)
            timer.start(1000)
            self.showlcd()
    
        def initUI(self):
    
            self.lcd = QtGui.QLCDNumber(self)
            self.lcd.setDigitCount(8)          # change the number of digits displayed
            self.setGeometry(30, 30, 800, 600)
            self.setWindowTitle('Time')
    
            vbox = QtGui.QVBoxLayout()
            vbox.addWidget(self.lcd)
            self.setLayout(vbox)
    
            self.show()
    
        def showlcd(self):
            time = QtCore.QTime.currentTime()
            text = time.toString('hh:mm:ss')
            self.lcd.display(text)
    
    
    def main():
    
        app = QtGui.QApplication(sys.argv)
        ex = Example()
        sys.exit(app.exec_())
    
    
    if __name__ == '__main__':
        main()
    
    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I just want to get the System IP address and display it on a
I want to display html code just like what your see here. <textarea><script id=ff>gdgdgs</script></textarea>
I want to display the posted comment once the user comments. Just to add
Just looking for a good PHP Image Library, I want to display images with
My HTML text is just like this: <p>abcdefghijklmnopqrstuvwxyz</p> What I want is to display
Just want to know if publishing an application on Google play is allowed using
I want to display the order invoice page with a custom theme but I
I just want to display Start or End Error Message on my msg column
Using C++ and .net I have a stream of data I want to display
I want to create a system of reporting/flagging comments. At this point Im just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.