-
Notifications
You must be signed in to change notification settings - Fork 0
/
simplecalcuv3.py
131 lines (120 loc) · 6.22 KB
/
simplecalcuv3.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'simplecalcuv3.ui'
#
# Created by: PyQt5 UI code generator 5.9
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
import qdarkstyle
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
app.setStyleSheet(qdarkstyle.load_stylesheet_pyqt5())
MainWindow.setObjectName("MainWindow")
MainWindow.resize(521, 547)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.label = QtWidgets.QLabel(self.centralwidget)
self.label.setGeometry(QtCore.QRect(60, 20, 431, 221))
self.label.setObjectName("label")
self.label_2 = QtWidgets.QLabel(self.centralwidget)
self.label_2.setGeometry(QtCore.QRect(30, 270, 161, 51))
font = QtGui.QFont()
font.setFamily("Calibri")
font.setPointSize(14)
font.setBold(True)
font.setItalic(True)
font.setWeight(75)
self.label_2.setFont(font)
self.label_2.setStyleSheet("color: rgb(255, 30, 10)")
self.label_2.setObjectName("label_2")
self.label_4 = QtWidgets.QLabel(self.centralwidget)
self.label_4.setGeometry(QtCore.QRect(40, 350, 131, 31))
font = QtGui.QFont()
font.setFamily("Calibri")
font.setPointSize(14)
font.setBold(True)
font.setItalic(True)
font.setWeight(75)
self.label_4.setFont(font)
self.label_4.setStyleSheet("color: rgb(255, 30, 10)")
self.label_4.setObjectName("label_4")
self.label_3 = QtWidgets.QLabel(self.centralwidget)
self.label_3.setGeometry(QtCore.QRect(100, 410, 271, 61))
font = QtGui.QFont()
font.setFamily("OCR A Extended")
font.setPointSize(20)
self.label_3.setFont(font)
self.label_3.setStyleSheet("color: rgb(152,251,152)")
self.label_3.setAlignment(QtCore.Qt.AlignCenter)
self.label_3.setObjectName("label_3")
self.pushButton = QtWidgets.QPushButton(self.centralwidget)
self.pushButton.setGeometry(QtCore.QRect(400, 290, 93, 71))
self.pushButton.setStyleSheet("border-radius : 100; border : 2px solid black\n"
"setGeometry(200, 150, 100, 100)")
self.pushButton.setObjectName("pushButton")
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setGeometry(QtCore.QRect(200, 270, 161, 41))
font = QtGui.QFont()
font.setPointSize(10)
self.lineEdit.setFont(font)
self.lineEdit.setObjectName("lineEdit")
self.lineEdit_2 = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit_2.setGeometry(QtCore.QRect(200, 340, 161, 41))
font = QtGui.QFont()
font.setPointSize(10)
font.setBold(False)
font.setWeight(50)
self.lineEdit_2.setFont(font)
self.lineEdit_2.setObjectName("lineEdit_2")
MainWindow.setCentralWidget(self.centralwidget)
self.menubar = QtWidgets.QMenuBar(MainWindow)
self.menubar.setGeometry(QtCore.QRect(0, 0, 521, 26))
self.menubar.setObjectName("menubar")
MainWindow.setMenuBar(self.menubar)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def Calcu():
num1 = self.lineEdit.text()
num2 = self.lineEdit_2.text()
# ans = multipy(num1 , num2)
try:
num1str = float(num1)
num2str = float(num2)
ans = (num2str*num1str)
print(ans)
self.label_3.setText(str("{0:.2f}".format(ans)))
# self.label_4.setText(ans)
except:
pass
self.pushButton.clicked.connect(Calcu)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "SimpleCalcu"))
self.label.setText(_translate("MainWindow", "░██████╗██╗███╗░░░███╗██████╗░██╗░░░░░███████╗\n"
"██╔════╝██║████╗░████║██╔══██╗██║░░░░░██╔════╝\n"
"╚█████╗░██║██╔████╔██║██████╔╝██║░░░░░█████╗░░\n"
"░╚═══██╗██║██║╚██╔╝██║██╔═══╝░██║░░░░░██╔══╝░░\n"
"██████╔╝██║██║░╚═╝░██║██║░░░░░███████╗███████╗\n"
"╚═════╝░╚═╝╚═╝░░░░░╚═╝╚═╝░░░░░╚══════╝╚══════╝\n"
"\n"
"░█████╗░░█████╗░██╗░░░░░░█████╗░██╗░░░██╗\n"
"██╔══██╗██╔══██╗██║░░░░░██╔══██╗██║░░░██║\n"
"██║░░╚═╝███████║██║░░░░░██║░░╚═╝██║░░░██║\n"
"██║░░██╗██╔══██║██║░░░░░██║░░██╗██║░░░██║\n"
"╚█████╔╝██║░░██║███████╗╚█████╔╝╚██████╔╝\n"
"░╚════╝░╚═╝░░╚═╝╚══════╝░╚════╝░░╚═════╝░"))
self.label_2.setText(_translate("MainWindow", "Value Per (mm)"))
self.label_4.setText(_translate("MainWindow", "Length (mm)"))
self.label_3.setText(_translate("MainWindow", "Answer"))
self.pushButton.setText(_translate("MainWindow", "CalCu"))
if __name__ == "__main__":
import sys
app = QtWidgets.QApplication(sys.argv)
MainWindow = QtWidgets.QMainWindow()
ui = Ui_MainWindow()
ui.setupUi(MainWindow)
MainWindow.show()
sys.exit(app.exec_())