-
Notifications
You must be signed in to change notification settings - Fork 0
/
calculator.py
198 lines (191 loc) · 9.21 KB
/
calculator.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
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
# -*- coding: utf-8 -*-
# Form implementation generated from reading ui file 'calculator.ui'
#
# Created by: PyQt5 UI code generator 5.13.1
#
# WARNING! All changes made in this file will be lost!
from PyQt5 import QtCore, QtGui, QtWidgets
class Ui_MainWindow(object):
def setupUi(self, MainWindow):
MainWindow.setObjectName("MainWindow")
MainWindow.resize(326, 398)
MainWindow.setCursor(QtGui.QCursor(QtCore.Qt.ArrowCursor))
MainWindow.setMouseTracking(False)
self.centralwidget = QtWidgets.QWidget(MainWindow)
self.centralwidget.setObjectName("centralwidget")
self.verticalLayout = QtWidgets.QVBoxLayout(self.centralwidget)
self.verticalLayout.setObjectName("verticalLayout")
self.lineEdit = QtWidgets.QLineEdit(self.centralwidget)
self.lineEdit.setMinimumSize(QtCore.QSize(0, 80))
font = QtGui.QFont()
font.setPointSize(16)
self.lineEdit.setFont(font)
self.lineEdit.setObjectName("lineEdit")
self.verticalLayout.addWidget(self.lineEdit)
spacerItem = QtWidgets.QSpacerItem(219, 30, QtWidgets.QSizePolicy.Expanding, QtWidgets.QSizePolicy.Minimum)
self.verticalLayout.addItem(spacerItem)
self.gridLayout = QtWidgets.QGridLayout()
self.gridLayout.setObjectName("gridLayout")
self.Num_1 = QtWidgets.QPushButton(self.centralwidget)
self.Num_1.setMinimumSize(QtCore.QSize(50, 50))
self.Num_1.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.Num_1.setFont(font)
self.Num_1.setObjectName("Num_1")
self.gridLayout.addWidget(self.Num_1, 0, 0, 1, 1)
self.Num_2 = QtWidgets.QPushButton(self.centralwidget)
self.Num_2.setMinimumSize(QtCore.QSize(50, 50))
self.Num_2.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.Num_2.setFont(font)
self.Num_2.setObjectName("Num_2")
self.gridLayout.addWidget(self.Num_2, 0, 1, 1, 1)
self.Num_3 = QtWidgets.QPushButton(self.centralwidget)
self.Num_3.setMinimumSize(QtCore.QSize(50, 50))
self.Num_3.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.Num_3.setFont(font)
self.Num_3.setObjectName("Num_3")
self.gridLayout.addWidget(self.Num_3, 0, 2, 1, 1)
self.OP_divide = QtWidgets.QPushButton(self.centralwidget)
self.OP_divide.setMinimumSize(QtCore.QSize(50, 50))
self.OP_divide.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.OP_divide.setFont(font)
self.OP_divide.setObjectName("OP_divide")
self.gridLayout.addWidget(self.OP_divide, 0, 3, 1, 1)
self.OP_CE = QtWidgets.QPushButton(self.centralwidget)
self.OP_CE.setMinimumSize(QtCore.QSize(50, 50))
self.OP_CE.setMaximumSize(QtCore.QSize(1000, 1000))
font = QtGui.QFont()
font.setPointSize(16)
self.OP_CE.setFont(font)
self.OP_CE.setObjectName("OP_CE")
self.gridLayout.addWidget(self.OP_CE, 0, 4, 4, 1)
self.Num_4 = QtWidgets.QPushButton(self.centralwidget)
self.Num_4.setMinimumSize(QtCore.QSize(50, 50))
self.Num_4.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.Num_4.setFont(font)
self.Num_4.setObjectName("Num_4")
self.gridLayout.addWidget(self.Num_4, 1, 0, 1, 1)
self.Num_5 = QtWidgets.QPushButton(self.centralwidget)
self.Num_5.setMinimumSize(QtCore.QSize(50, 50))
self.Num_5.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.Num_5.setFont(font)
self.Num_5.setObjectName("Num_5")
self.gridLayout.addWidget(self.Num_5, 1, 1, 1, 1)
self.Num_6 = QtWidgets.QPushButton(self.centralwidget)
self.Num_6.setMinimumSize(QtCore.QSize(50, 50))
self.Num_6.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.Num_6.setFont(font)
self.Num_6.setObjectName("Num_6")
self.gridLayout.addWidget(self.Num_6, 1, 2, 1, 1)
self.OP_time = QtWidgets.QPushButton(self.centralwidget)
self.OP_time.setMinimumSize(QtCore.QSize(50, 50))
self.OP_time.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.OP_time.setFont(font)
self.OP_time.setObjectName("OP_time")
self.gridLayout.addWidget(self.OP_time, 1, 3, 1, 1)
self.Num_7 = QtWidgets.QPushButton(self.centralwidget)
self.Num_7.setMinimumSize(QtCore.QSize(50, 50))
self.Num_7.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.Num_7.setFont(font)
self.Num_7.setObjectName("Num_7")
self.gridLayout.addWidget(self.Num_7, 2, 0, 1, 1)
self.Num_8 = QtWidgets.QPushButton(self.centralwidget)
self.Num_8.setMinimumSize(QtCore.QSize(50, 50))
self.Num_8.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.Num_8.setFont(font)
self.Num_8.setObjectName("Num_8")
self.gridLayout.addWidget(self.Num_8, 2, 1, 1, 1)
self.Num_9 = QtWidgets.QPushButton(self.centralwidget)
self.Num_9.setMinimumSize(QtCore.QSize(50, 50))
self.Num_9.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.Num_9.setFont(font)
self.Num_9.setObjectName("Num_9")
self.gridLayout.addWidget(self.Num_9, 2, 2, 1, 1)
self.OP_minus = QtWidgets.QPushButton(self.centralwidget)
self.OP_minus.setMinimumSize(QtCore.QSize(50, 50))
self.OP_minus.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.OP_minus.setFont(font)
self.OP_minus.setObjectName("OP_minus")
self.gridLayout.addWidget(self.OP_minus, 2, 3, 1, 1)
self.Num_dot = QtWidgets.QPushButton(self.centralwidget)
self.Num_dot.setMinimumSize(QtCore.QSize(50, 50))
self.Num_dot.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.Num_dot.setFont(font)
self.Num_dot.setObjectName("Num_dot")
self.gridLayout.addWidget(self.Num_dot, 3, 0, 1, 1)
self.Num_0 = QtWidgets.QPushButton(self.centralwidget)
self.Num_0.setMinimumSize(QtCore.QSize(50, 50))
self.Num_0.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.Num_0.setFont(font)
self.Num_0.setObjectName("Num_0")
self.gridLayout.addWidget(self.Num_0, 3, 1, 1, 1)
self.OP_equal = QtWidgets.QPushButton(self.centralwidget)
self.OP_equal.setMinimumSize(QtCore.QSize(50, 50))
self.OP_equal.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.OP_equal.setFont(font)
self.OP_equal.setObjectName("OP_equal")
self.gridLayout.addWidget(self.OP_equal, 3, 2, 1, 1)
self.OP_plus = QtWidgets.QPushButton(self.centralwidget)
self.OP_plus.setMinimumSize(QtCore.QSize(50, 50))
self.OP_plus.setMaximumSize(QtCore.QSize(50, 50))
font = QtGui.QFont()
font.setPointSize(16)
self.OP_plus.setFont(font)
self.OP_plus.setObjectName("OP_plus")
self.gridLayout.addWidget(self.OP_plus, 3, 3, 1, 1)
self.verticalLayout.addLayout(self.gridLayout)
MainWindow.setCentralWidget(self.centralwidget)
self.statusbar = QtWidgets.QStatusBar(MainWindow)
self.statusbar.setObjectName("statusbar")
MainWindow.setStatusBar(self.statusbar)
self.retranslateUi(MainWindow)
QtCore.QMetaObject.connectSlotsByName(MainWindow)
def retranslateUi(self, MainWindow):
_translate = QtCore.QCoreApplication.translate
MainWindow.setWindowTitle(_translate("MainWindow", "MainWindow"))
self.Num_1.setText(_translate("MainWindow", "1"))
self.Num_2.setText(_translate("MainWindow", "2"))
self.Num_3.setText(_translate("MainWindow", "3"))
self.OP_divide.setText(_translate("MainWindow", "/"))
self.OP_CE.setText(_translate("MainWindow", "CE"))
self.Num_4.setText(_translate("MainWindow", "4"))
self.Num_5.setText(_translate("MainWindow", "5"))
self.Num_6.setText(_translate("MainWindow", "6"))
self.OP_time.setText(_translate("MainWindow", "*"))
self.Num_7.setText(_translate("MainWindow", "7"))
self.Num_8.setText(_translate("MainWindow", "8"))
self.Num_9.setText(_translate("MainWindow", "9"))
self.OP_minus.setText(_translate("MainWindow", "-"))
self.Num_dot.setText(_translate("MainWindow", "."))
self.Num_0.setText(_translate("MainWindow", "0"))
self.OP_equal.setText(_translate("MainWindow", "="))
self.OP_plus.setText(_translate("MainWindow", "+"))