Real Time Loop (Clock) using Date Edit in PYQT4
<p>My question is this: How do I use the qtimeEdit in PYQT4 to loop &amp; update, so it is always displaying the current time. Essentially, I would like it to function just like the Windows Taskbar time and date.  </p>

<p>For example: </p>

<pre><code>from PyQt4 import QtCore, QtGui
from PyQt4 import phonon
import sys
import os


try:
    _fromUtf8 = QtCore.QString.fromUtf8
except AttributeError:
    def _fromUtf8(s):
        return s

try:
    _encoding = QtGui.QApplication.UnicodeUTF8


    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig, _encoding)
except AttributeError:
    def _translate(context, text, disambig):
        return QtGui.QApplication.translate(context, text, disambig)


class Ui_MainWindow(object):
    def setupUi(self, MainWindow):
        MainWindow.setWindowFlags(QtCore.Qt.WindowContextHelpButtonHint)
        MainWindow.setObjectName(_fromUtf8("MainWindow"))
        MainWindow.resize(885, 450)
        MainWindow.setMinimumSize(QtCore.QSize(885, 450))
        MainWindow.setMaximumSize(QtCore.QSize(885, 491))
        MainWindow.setMouseTracking(False)        self.timeEdit = QtGui.QTimeEdit(self.splitter)

        self.timeEdit.setCursor(QtGui.QCursor(QtCore.Qt.BusyCursor))
        self.timeEdit.setAutoFillBackground(True)
        self.timeEdit.setWrapping(True)
        self.timeEdit.setFrame(True)
        self.timeEdit.setAlignment(QtCore.Qt.AlignCenter)
        self.timeEdit.setReadOnly(True)
        self.timeEdit.setButtonSymbols(QtGui.QAbstractSpinBox.NoButtons)
        self.timeEdit.setKeyboardTracking(True)
        self.timeEdit.setObjectName(_fromUtf8("timeEdit"))


    def retranslateUi(self, MainWindow):

        Today = QtCore.QDate.currentDate()
        self.dateEdit.setDate(Today)

        self.ui.timeEdit = QtGui.QTimeEdit(self)
        self.timeEdit.setDisplayFormat("hh:mm:ss AP")
        self.updateTime()
        self.timer = QtCore.QTimer(self)
        self.timer.timeout.connect(self.updateTime)
        self.timer.start(1000)



    def updateTime(self):
        current = QtCore.QDateTime.currentDateTime()
        self.timeEdit.setTime(current.time())




class ControlMainWindow(QtGui.QMainWindow):
    def __init__(self, parent=None):
        super(ControlMainWindow, self).__init__(parent)
        self.ui = Ui_MainWindow()
        self.ui.setupUi(self)


    def closeEvent(self, event):
        result = QtGui.QMessageBox.critical(self,
                                            "Confirm Exit...",
                                            "Are you sure you want to exit ?",
                                            QtGui.QMessageBox.Yes | QtGui.QMessageBox.No)
        event.ignore()

        if result == QtGui.QMessageBox.Yes:
            event.accept()

    def VoluemChanger(self, audioOutput):
        self.ui.volumeSlider.setAudioOutput(self.ui.videoPlayer.audioOutput())



if __name__ == '__main__':
    app = QtGui.QApplication(sys.argv)
    mySW = ControlMainWindow()
    mySW.show()
    sys.exit(app.exec_())
</code></pre>