from PyQt5.QtWidgets import QApplication, QMainWindow, QMessageBox
from PyQt5.QtCore import Qt
from untitled import *
class MainWindow(QMainWindow, Ui_Form):
def __init__(self):
super(MainWindow, self).__init__()
self.setupUi(self)
self.pushButton.setStyleSheet('''
QPushButton
{text-align : center;
color:red;
font: bold;
border-color: red;
border-width: 5px;
border-radius: 10px;
padding: 6px;
height : 14px;
border-style: outset;
font : 14px;}
QPushButton:pressed
{text-align : center;
background-color : red;
color:red;
font: bold;
border-color: red;
border-width: 5px;
border-radius: 10px;
padding: 6px;
height : 14px;
border-style: outset;
font : 14px;}
''')
self.pushButton_2.setStyleSheet('''
QPushButton
{text-align : center;
color:red;
font: bold;
border-color: red;
border-width: 5px;
border-radius: 10px;
padding: 6px;
height : 14px;
border-style: outset;
font : 14px;}
QPushButton:pressed
{text-align : center;
background-color : red;
color:red;
font: bold;
border-color: red;
border-width: 5px;
border-radius: 10px;
padding: 6px;
height : 14px;
border-style: outset;
font : 14px;}
''')
self.time()
timer = QTimer(self)
timer.timeout.connect(self.time)
timer.start()
def time(self):
currenttime = QTime.currentTime()
currentdate = QDate.currentDate()
texttime = currenttime.toString()
textdate = currentdate.toString()
text = " " + textdate + " " + texttime
self.text = text
self.label.setText(text)
self.label.setFont(QFont("Roman times", 15))
if __name__ == '__main__':
import sys
QApplication.setAttribute(Qt.AA_EnableHighDpiScaling)
app = QApplication(sys.argv)
formmain = MainWindow()
formmain.show()
sys.exit(app.exec_())