daily pastebin goal
53%
SHARE
TWEET

Untitled

a guest Feb 18th, 2019 64 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. Traceback (most recent call last):
  2. File "C:/Python34/showtime.pyw", line 3, in <module>
  3. from disptime import*
  4. ImportError: No module named 'disptime'
  5.    
  6. from PyQt4 import QtCore, QtGui
  7.  
  8. try:
  9. _fromUtf8 = QtCore.QString.fromUtf8
  10. except AttributeError:
  11. def _fromUtf8(s):
  12.     return s
  13.  
  14. try:
  15. _encoding = QtGui.QApplication.UnicodeUTF8
  16. def _translate(context, text, disambig):
  17.     return QtGui.QApplication.translate(context, text, disambig, _encoding)
  18. except AttributeError:
  19. def _translate(context, text, disambig):
  20.     return QtGui.QApplication.translate(context, text, disambig)
  21.  
  22. class Ui_Dialog(object):
  23. def setupUi(self, Dialog):
  24.     Dialog.setObjectName(_fromUtf8("Dialog"))
  25.     Dialog.resize(400, 300)
  26.     self.lcdNumber = QtGui.QLCDNumber(Dialog)
  27.     self.lcdNumber.setGeometry(QtCore.QRect(130, 22, 201, 81))
  28.     self.lcdNumber.setObjectName(_fromUtf8("lcdNumber"))
  29.  
  30.     self.retranslateUi(Dialog)
  31.     QtCore.QMetaObject.connectSlotsByName(Dialog)
  32.  
  33. def retranslateUi(self, Dialog):
  34.     Dialog.setWindowTitle(_translate("Dialog", "Dialog", None))
  35.  
  36.  
  37. if __name__ == "__main__":
  38. import sys
  39. app = QtGui.QApplication(sys.argv)
  40. Dialog = QtGui.QDialog()
  41. ui = Ui_Dialog()
  42. ui.setupUi(Dialog)
  43. Dialog.show()
  44. sys.exit(app.exec_())
  45.    
  46. import sys
  47. from PyQt4 import QtCore, QtGui                
  48. from disptime import*                                              
  49.  
  50. class MyForm(QtGui.QDialog):                          
  51. def __init__(self, parent=None):
  52.     QtGui.QWidget.__init__(self, parent)
  53.  
  54.     self.ui = Ui_Dialog()
  55.     self.ui.setupUi(self)
  56.     timer = QtCore.QTimer(self)
  57.     timer.timeout.connect(self.showlcd)
  58.     timer.start(1000)
  59.     self.showlcd()
  60.  
  61. def showlcd(self):
  62.     time = QtCore.QTime.currentTime()
  63.     text = time.toString('hh:mm')
  64.     self.ui.lcdNumber.display(text)
  65.  
  66. if __name__ == "__main__":
  67. app = QtGui.QApplication(sys.argv)
  68. myapp = MyForm()
  69. myapp.show()
  70. sys.exit(app.exec_())
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top