'Old script using graphics.py crashes in pycharm and returns "Object Currently Drawn" error

Years ago I took a "Python for gaming" class and made a little game using graphics.py as the class final. The program has interactions based on mouse clicks, uses WASD to move, and has status changes based on position that limit interaction (you have to walk your muddy artifact through a sink before it can be displayed). The program worked fully back when I made it in IDLE in 2017 and the final piece of the game is an image that explains the artifacts you found.

Recently I started taking a "Python for GIS" class and dug up all my old classwork to see if I could make any more of the game. We're using Pycharm and when I run it from Pycharm, the window opens and I can play the game exactly as I remember, with one exception. When I click the last artifact into the museum case, I catch a flash of the final screen but the window closes immediately and Pycharm returns an error from line 217, which looks like this:

`if arrowVis == True and potteryVis == True and statueVis == True:
    succeed.draw(win)`

Line 217 is the succeed.draw(win) and the error code says "Object Currently Drawn." I've tried taking it through the Pycharm debugger, which immediately exposes a different issue: at "from graphics import*" right at the top, the debugger says "BAD OPTION: Illegal option value."

I've tried researching this and I still don't have an answer. I can see people saying that "from graphics import *" is sloppy code (fair, it was an IT102 class), but I don't see examples of what to do instead. I've tried different ways of keeping the window open, including win.mainloop() and win.getMouse()+win.close() but none of that has helped.

I've tried moving around where the graphics.py file is to see if the issue is an access issue, to no avail. I have not been able to find any forum posts about this specific combo of errors or what is going wrong. I've tried the Zelle graphics documentation, again to no success.

What could be going wrong here? I don't want to attach the entire program but I can if need be.

Edit

Here is the full traceback I get every time it crashes right at the end of the game:

Traceback (most recent call last): File "C:/Users/nikha/Desktop/Geog411/01 NOT CLASS SANDBOX/archydig.py", line 217, in succeed.draw(win) File "C:\Users\nikha\Desktop\Geog411\01 NOT CLASS SANDBOX\graphics.py", line 481, in draw if self.canvas and not self.canvas.isClosed(): raise GraphicsError(OBJ_ALREADY_DRAWN) graphics.GraphicsError: Object currently drawn

I tried switching to import graphics and added graphics. to the rest of the code. This fixed the issues that were popping up in the debugger, but the final crash still happens and returns the same error shown above.



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source