Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- # -*- coding: utf-8 -*-
- import sys
- import PySide.QtCore as QtCore
- import PySide.QtGui as QtGui
- class DigitalClock(QtGui.QLCDNumber):
- def __init__(self, parent=None):
- super(DigitalClock, self).__init__(parent)
- self.setSegmentStyle(QtGui.QLCDNumber.Filled)
- timer = QtCore.QTimer(self)
- timer.timeout.connect(self.showTime)
- timer.start(1000)
- self.showTime()
- self.setWindowTitle("Digital Clock")
- self.resize(150, 60)
- def showTime(self):
- time = QtCore.QTime.currentTime()
- text = time.toString('hh:mm')
- if (time.second() % 2) == 0:
- text = text[:2] + ' ' + text[3:]
- self.display(text)
- if __name__ == '__main__':
- app = QtGui.QApplication(sys.argv)
- clock = DigitalClock()
- clock.show()
- sys.exit(app.exec_())
Advertisement
Add Comment
Please, Sign In to add comment