Starting Project 2 "Game of Life". I tried running the template and got an error that "Windows" name is undefined. Looked at graphics.py and it appears that there is only a Graphwin class. Changed statement in template file and now get a window to open, but hangs up because it does not find a canvasFrame class. Is there something else that needs to be imported? Thanks, Sigurd aka kj1k
I just started as well. I haven't made any changes to template yet, but I didn't get the error you described. It created a blank window and then got a Python error looking for an __init__ method which I had not yet supplied.
There is a Window class defined at line 836 in graphics.py right after the definition of the GraphWin class. I put some print statements into game_of_life.py right aftet the "Initialize Board" comment to make sure that the class was being created. It was. It sailed right through with no problem. I don't know why its not working for you.
I am using graphics.py version 4.2.5, dated 5/26/2011. Are you using the same version? I don't see a Window class defined at all. Thanks, Sigurd aka kj1k
I used the graphics.py and documentation linked to from the course page ( http://ocw.mit.edu/courses/electrical-engineering-and-computer-science/6-189-a-gentle-introduction-to-programming-using-python-january-iap-2011/assignments/ ) The highest version number listed update history comments is Version 3.5 5/10/09.
Thank you very much. Not sure how/why I got a later incompatible version of the library. Looks like it solved my immediate problem. Still have work to do, but this one is solved.
You are very welcome. Just got the simulate step to work (I think). Was confusing in that I forgot that a "for" loop on a dictionary returns the keys, not the item from the dictionary whose value is obtained with the key. I thought I had a "block" when in fact I had a tuple. I wasn't sure what "toad" was supposed to do. The simulate changed the grid and I had to work it out by hand to be sure it was correct.
I'm thinking that the pulsar block list may be incorrect or incomplete. It went through 8 changes and then became a fixed pattern. It didn't look like the picture from the Conway Wiki.
Join our real-time social learning platform and learn together with your friends!