driscollis / applications_with_wxpython

Code examples for the book, Creating GUI Application with wxPython
https://www.blog.pythonlibrary.org
116 stars 26 forks source link

Chapter 6, Page 71 (ePub) #5

Closed cmcknight closed 5 years ago

cmcknight commented 5 years ago

The text reads:

“The next method you will need to update is update_equation():

.. code-block:: python

 1 def update\_equation(self, text):
 2     operators = \['/', '\*', '-', '+'\]
 3     current\_equation = self.solution.GetValue()
 4 
 5     if text not in operators:
 6         if self.last\_button\_pressed in operators:
 7             self.solution.SetValue(current\_equation + ' ' + text)
 8         elif self.empty and current\_equation:
 9             \# The solution is not empty
10             self.empty = False
11         else:
12             self.solution.SetValue(current\_equation + text)
13     elif text in operators and current\_equation is not '' \\
14          and self.last\_button\_pressed not in operators:
15         self.solution.SetValue(current\_equation + ' ' + text)
16 
17     self.last\_button\_pressed = text
18     self.solution.SetInsertionPoint(-1)
19 
20     for item in operators:
21         if item in self.solution.GetValue():
22             self.update\_solution()
23             break
”

which does not match the code in the repo. Also note the backslashes in front of all of the special characters that need to be removed. :-)

driscollis commented 5 years ago

Yeah, I have been running into a lot of issues with my conversion process. I thought I had all of those issues resolved, but it looks like there are a few issues left. Fortunately all my new chapters won't have conversion issues as I have dropped doing that process. This will also be fixed in tonight's build of the book