赞
踩
- from PyQt5.QtWidgets import *
- from PyQt5.QtCore import *
- import sys
- from datetime import datetime
-
- class WinTimer(QWidget):
- def __init__(self,parent=None):
- super(WinTimer,self).__init__(parent)
-
- ###界面显示
- self.label_start=QLabel("开始时间:")
- self.label_curr=QLabel("当前时间:")
- self.label_total=QLabel("时间总计:")
- self.startBtn=QPushButton("开始")
- self.endBtn=QPushButton("停止")
- self.endBtn.setEnabled(False)
-
- ##时间变量
- self.start_time=QDateTime.currentDateTime()
- self.stop_time = QDateTime.currentDateTime()
-
- ###定时器
- self.timer=QTimer()
- self.timer.timeout.connect(self.currTime)
-
- layout=QGridLayout()
- layout.addWidget(self.label_start,0,0,1,2)
- layout.addWidget(self.label_curr, 1,0,1,2)
- layout.addWidget(self.label_total, 2,0,1,2)
- layout.addWidget(

赞
踩
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。