Problems updating digital clock widget in PyQt4 - calling slot and signal
Question: Ok so this is an edited version of my previous post. I am trying to place a
digital clock onto a home window. I am having difficulty updating the value. I
saw a tutorial
[1](http://codeprogress.com/python/libraries/pyqt/showPyQTExample.php?key=QLCDNumberDigitalClock&index=409)
that called a method with @pyqtSlot() in a different class but because I am
working in the main window class, I was not able to call this and the clock
did not appear at all. The following code below brings up the current time but
the clock is not updated:

    
    
    from PyQt4.QtGui import *
    from PyQt4.QtCore import *
    import sys
    
    class Window(QMainWindow):
    
        def __init__(self):
            super(Window, self).__init__()
            self.setGeometry(50,50,500,300)
            self.home()
    
        def home(self):
    
            lcdNumber = QLCDNumber(self)
            timer = QTimer()
            lcdNumber.setDigitCount(8)
            self.showTime(lcdNumber)
            lcdNumber.connect(timer,SIGNAL("timeout()"),lcdNumber,SLOT("showTime()"))
            timer.start(1000)
            self.show()
    
    
        @pyqtSlot()
        def showTime(self,lcdNumber):
            lcdNumber.display(QTime.currentTime().toString("hh:mm:ss"))
    
    
    def run():    
            app=QApplication(sys.argv)
            GUI = Window()
            sys.exit(app.exec_())
    
    run()
    


Answer: Ok so I found a work around using some code I found
[here](http://thecodeinn.blogspot.co.uk/2013/07/tutorial-pyqt-digital-
clock.html) but I am still unsure how to get the signal and slot functions
operational.

    
    
    from PyQt4.QtGui import *
    from PyQt4.QtCore import *
    import sys
    
    from time import strftime
    
    class Window(QMainWindow):
    
        def __init__(self):
            super(Window, self).__init__()
            self.setGeometry(50,50,700,300)
            self.home()
    
        def home(self):
    
            self.timer =QTimer(self)
            self.timer.timeout.connect(self.Time)
            self.timer.start(1000)
    
            self.lcd = QLCDNumber(self)
            self.lcd.display(strftime("%H"+":"+"%M"+":"+"%S"))
            self.lcd.setDigitCount(8)
    
            self.show()
    
        def Time(self):
            self.lcd.display(strftime("%H"+":"+"%M"+":"+"%S"))     
    
    
    def run():    
            app=QApplication(sys.argv)
            GUI = Window()
            sys.exit(app.exec_())
    
    run()
    

