@@ -56,7 +56,8 @@ def __init__(self, *args, **kwargs):
5656 self .label .setStyleSheet ("""background-color : white;
5757 color: #0B132B;
5858 border-radius: 10px;
59- border: 2px solid #7F2982;
59+ border: 1px solid #7F2982;
60+ min-height: 40px;
6061 """ )
6162
6263 self .label .setAlignment (QtCore .Qt .AlignRight )
@@ -79,10 +80,11 @@ def __init__(self, *args, **kwargs):
7980 self .textbox1 .setValidator (validator )
8081 self .textbox1 .setAlignment (QtCore .Qt .AlignRight )
8182 self .textbox1 .setStyleSheet ("""background-color : white;
82- color: #0B132B;
83- border-radius: 10px;
84- border: 2px solid #7F2982;
85- """ )
83+ color: #0B132B;
84+ border-radius: 10px;
85+ border: 1px solid #7F2982;
86+ min-height: 40px;
87+ """ )
8688 self .layout .addRow ('Number 1:' , self .textbox1 )
8789
8890 self .textbox2 = QLineEdit (self )
@@ -91,19 +93,21 @@ def __init__(self, *args, **kwargs):
9193 self .textbox2 .setValidator (validator )
9294 self .textbox2 .setAlignment (QtCore .Qt .AlignRight )
9395 self .textbox2 .setStyleSheet ("""background-color : white;
94- color: #0B132B;
95- border-radius: 10px;
96- border: 2px solid #7F2982;
97- """ )
96+ color: #0B132B;
97+ border-radius: 10px;
98+ border: 1px solid #7F2982;
99+ min-height: 40px;
100+ """ )
98101 self .layout .addRow ('Number 2:' , self .textbox2 )
99102
100103 # Create a text box for displaying calculation history
101104 self .history = QTextEdit ()
102- self .history .setStyleSheet ("""background-color : white;
103- color: #0B132B;
104- border-radius: 10px;
105- border: 2px solid #7F2982;
106- """ )
105+ self .history .setStyleSheet ("""background-color : white;
106+ color: #0B132B;
107+ border-radius: 10px;
108+ border: 1px solid #7F2982;
109+ min-height: 40px;
110+ """ )
107111 self .layout .addRow ('History:' , self .history )
108112
109113 # Create a grid layout for arranging buttons
@@ -216,7 +220,8 @@ def save_history(self):
216220 border-radius: 10px;
217221 padding: 10px 15px;
218222 margin-top: 0px;
219- outline: 0px;}
223+ outline: 0px;
224+ min-width: 100px;}
220225 QPushButton:hover {background-color: #7F2982 }
221226 """ )
222227 messagebox .exec_ ()
@@ -248,8 +253,18 @@ def calculate(self, operation):
248253 try :
249254 a = float (self .textbox1 .text ())
250255 b = float (self .textbox2 .text ())
251- self .textbox1 .setStyleSheet ("background-color : white; color : black" )
252- self .textbox2 .setStyleSheet ("background-color : white; color : black" )
256+ self .textbox1 .setStyleSheet ("""background-color : white;
257+ color: #0B132B;
258+ border-radius: 10px;
259+ border: 1px solid #7F2982;
260+ min-height: 40px;
261+ """ )
262+ self .textbox2 .setStyleSheet ("""background-color : white;
263+ color: #0B132B;
264+ border-radius: 10px;
265+ border: 1px solid #7F2982;
266+ min-height: 40px;
267+ """ )
253268
254269 if operation == 'sum' :
255270 res = self .calculator .add (a , b )
@@ -270,30 +285,47 @@ def calculate(self, operation):
270285 self .history .setText (str (a ) + ope + str (b ) + " = " + str (res ) + "\n " + self .history .toPlainText ())
271286
272287 except ValueError :
273- self .textbox1 .setStyleSheet ("background-color : pink; color : black" )
274- self .textbox2 .setStyleSheet ("background-color : pink; color : black" )
288+ self .textbox1 .setStyleSheet ("""background-color : white;
289+ color: #0B132B;
290+ border-radius: 10px;
291+ border: 4px solid #F7717D;
292+ min-height: 40px;
293+ """ )
294+ self .textbox2 .setStyleSheet ("""background-color : white;
295+ color: #0B132B;
296+ border-radius: 10px;
297+ border: 4px solid #F7717D;
298+ min-height: 40px;
299+ """ )
275300 messagebox = QMessageBox (QMessageBox .Information , "Error" , "Input can only be a number!" , buttons = QMessageBox .Ok , parent = self )
276301 messagebox .setIconPixmap (QPixmap (stop_writing ))
277302 messagebox .findChild (QPushButton ).setStyleSheet ("""QPushButton {background-color: #0B132B;
278303 color: white;
279304 border-radius: 10px;
280305 padding: 10px 15px;
281306 margin-top: 0px;
282- outline: 0px;}
307+ outline: 0px;
308+ min-width: 100px;}
283309 QPushButton:hover {background-color: #7F2982 }
284310 """ )
285311 messagebox .exec_ ()
286312
287313 except ZeroDivisionError :
288- self .textbox2 .setStyleSheet ("background-color : pink; color : black" )
314+ self .textbox2 .setStyleSheet ("""background-color : #F7717D;
315+ color: #0B132B;
316+ border-radius: 10px;
317+ border: 1px solid #7F2982;
318+ min-height: 40px;
319+ """ )
289320 messagebox = QMessageBox (QMessageBox .Warning , "Error" , "Division by zero is not allowed!" , buttons = QMessageBox .Ok , parent = self )
290321 messagebox .setIconPixmap (QPixmap (stop_writing ))
291322 messagebox .findChild (QPushButton ).setStyleSheet ("""QPushButton {background-color: #0B132B;
292323 color: white;
293324 border-radius: 10px;
294325 padding: 10px 15px;
295326 margin-top: 0px;
296- outline: 0px;}
327+ outline: 0px;
328+ min-width: 100px;}
297329 QPushButton:hover {background-color: #7F2982 }
298330 """ )
299331 messagebox .exec_ ()
0 commit comments