Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- Traceback (most recent call last):
- File "C:/Python34/showtime.pyw", line 3, in <module>
- from disptime import*
- ImportError: No module named 'disptime'
- from PyQt4 import QtCore, QtGui
- 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_Dialog(object):
- def setupUi(self, Dialog):
- Dialog.setObjectName(_fromUtf8("Dialog"))
- Dialog.resize(400, 300)
- self.lcdNumber = QtGui.QLCDNumber(Dialog)
- self.lcdNumber.setGeometry(QtCore.QRect(130, 22, 201, 81))
- self.lcdNumber.setObjectName(_fromUtf8("lcdNumber"))
- self.retranslateUi(Dialog)
- QtCore.QMetaObject.connectSlotsByName(Dialog)
- def retranslateUi(self, Dialog):
- Dialog.setWindowTitle(_translate("Dialog", "Dialog", None))
- if __name__ == "__main__":
- import sys
- app = QtGui.QApplication(sys.argv)
- Dialog = QtGui.QDialog()
- ui = Ui_Dialog()
- ui.setupUi(Dialog)
- Dialog.show()
- sys.exit(app.exec_())
- import sys
- from PyQt4 import QtCore, QtGui
- from disptime import*
- class MyForm(QtGui.QDialog):
- def __init__(self, parent=None):
- QtGui.QWidget.__init__(self, parent)
- self.ui = Ui_Dialog()
- self.ui.setupUi(self)
- timer = QtCore.QTimer(self)
- timer.timeout.connect(self.showlcd)
- timer.start(1000)
- self.showlcd()
- def showlcd(self):
- time = QtCore.QTime.currentTime()
- text = time.toString('hh:mm')
- self.ui.lcdNumber.display(text)
- if __name__ == "__main__":
- app = QtGui.QApplication(sys.argv)
- myapp = MyForm()
- myapp.show()
- sys.exit(app.exec_())
Add Comment
Please, Sign In to add comment