Here's the question you clicked on:

55 members online
  • 0 replying
  • 0 viewing

kj1k

  • 3 years ago

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

  • This Question is Closed
  1. Screech
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    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.

  2. Screech
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    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.

  3. kj1k
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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

  4. Screech
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    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.

  5. kj1k
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 0

    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.

  6. Screech
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    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.

  7. Screech
    • 3 years ago
    Best Response
    You've already chosen the best response.
    Medals 2

    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.

  8. Not the answer you are looking for?
    Search for more explanations.

    • Attachments:

Ask your own question

Sign Up
Find more explanations on OpenStudy
Privacy Policy