1515import sys
1616from functools import partial
1717
18- # 1. Import QApplication, and the required widgets from PyQt5.QtWidgets
18+ # Import QApplication, and the required widgets from PyQt5.QtWidgets
1919from PyQt5 .QtWidgets import QApplication
2020from PyQt5 .QtWidgets import QMainWindow
2121from PyQt5 .QtWidgets import QWidget
3131ERROR_MSG = 'ERROR'
3232
3333
34- # 2. Create a subclass of QMainWindow to setup the calculator's GUI
34+ # Create a subclass of QMainWindow to setup the calculator's GUI
3535class PyCalcUi (QMainWindow ):
3636 """PyCalc's View (GUI)."""
3737
@@ -109,7 +109,7 @@ def clearDisplay(self):
109109 self .setDisplayText ('' )
110110
111111
112- # 3. Create a Model to handle the calculator's operation
112+ # Create a Model to handle the calculator's operation
113113def evaluateExpression (expression ):
114114 """Evaluate an expression."""
115115 try :
@@ -120,7 +120,7 @@ def evaluateExpression(expression):
120120 return result
121121
122122
123- # 4. Create a Controller class to connect the GUI, and the model
123+ # Create a Controller class to connect the GUI, and the model
124124class PyCalcCtrl :
125125 """PyCalc's Controller."""
126126
@@ -158,15 +158,15 @@ def _connectSignals(self):
158158# Client code
159159def main ():
160160 """Main function."""
161- # 5. Create an instance of `QApplication`
161+ # Create an instance of `QApplication`
162162 pycalc = QApplication (sys .argv )
163- # 6. Show the calculator's GUI
163+ # Show the calculator's GUI
164164 view = PyCalcUi ()
165165 view .show ()
166- # 7. Create an instance of the model, and the controller
166+ # Create an instance of the model, and the controller
167167 model = evaluateExpression
168168 PyCalcCtrl (model = model , view = view )
169- # 8. Execute calculator's main loop
169+ # Execute calculator's main loop
170170 sys .exit (pycalc .exec_ ())
171171
172172
0 commit comments