next up previous
Next: Results and Conclusions Up: Creating a Drawing Program Previous: Procedure

Discussion

The Python language is somewhat different from C++ (the language with which I am most familiar) in that it has fewer syntax requirements. Coding in Python is more like writing a story than writing out equations, and the commands are free of semicolons, excessive parenthases, and declarations. Truly, Python is a very high-level language. On the other hand, the process of programming in Python is almost like doing recursive programming.

The way in which I programmed my project included the use of various widgets built into the Python language. These widgets most notably include Buttons, Frames, and Canvases. The basic organization of my project included a background Frame upon which I packed buttons to the left and a Canvas widget to the right. The class in which I programmed the Buttons was called the Panel class, the Canvas was in the Easel class, and all were called from the Base class. The final command in my program, which shows the recursive part of Python, is "if __name__ == '__main__': base().mainloop()." When organizing my program I had to trigger everything with events. The "mainloop()" function keeps the base Frame updated and waits for any events like mouse clicks or keystrokes. One way in which the recursive nature of Python makes it worse than C++ is in the method for calling class functions. In my program I tried to call an easel function (DrawCircle) from inside the Panel function. The final effect would be that when the Panel buttons received an event, that event would trigger a call to make the easel perform the task. For example, by clicking the 'Circle' button, the Circle function in Panel would call easel.DrawCircle. In easel.DrawCircle the code for actually creating the circle on my Canvas would be executed. Unfortunately, somewhere along the line the chain of events got kinked. When I pushed on the 'Circle' button, triggering an event, panel.Circle would call easel.DrawCircle, but the actual circle would never show up. It was at this point that I remained halted over a period of many weeks, and eventually halted altogether. Despite contacting members of a Python mailing list, with the help of Mr. Latimer, I never found an answer to my problem.


next up previous
Next: Results and Conclusions Up: Creating a Drawing Program Previous: Procedure
Kelly L. Geoghegan 2003-06-03