Ask your own question, for FREE!
MIT 6.189 A Gentle Introduction to Programming Using Python (OCW) 13 Online
OpenStudy (anonymous):

Iam working on the final project. Having trouble with draw current shape in Tetris __init__ method. If anyone can help Iam totaly lost. My ramdom shape is returned to self.current_shape but I can't draw it on the tetris board.

OpenStudy (konradzuse):

post code, and errors, etc.

OpenStudy (anonymous):

This is the code to draw shape: self.current_shape.draw(self.win) This is the error message: Traceback (most recent call last): File "C:\Python25\tetris_template.py", line 518, in <module> game = Tetris(win) File "C:\Python25\tetris_template.py", line 434, in __init__ self.current_shape.draw(self.win) File "C:\Python25\tetris_template.py", line 96, in draw block.draw(win) File "C:\Python25\graphics.py", line 363, in draw if canvas_frame.isClosed(): raise GraphicsError, "Can't draw to closed window" File "C:\Python25\lib\lib-tk\Tkinter.py", line 1732, in __getattr__ return getattr(self.tk, attr) AttributeError: isClosed

OpenStudy (konradzuse):

hmmm stll no idea, we need code examples.

OpenStudy (konradzuse):

look at the lines and see where your error is.

OpenStudy (rsmith6559):

Looks to me like your window isn't open.

OpenStudy (anonymous):

How do you open the window

OpenStudy (konradzuse):

It cannot be that hard. I could make a tetris game in Java. I wouldn't give up, keep at it. Window is probably the top level container like a JFrame. Then you put the Canvas like an AWT canvas then the rest of your components go on that. You're also giving up without showing us your code to help you. You expect us to know your issue without meeting us at least half way.

OpenStudy (anonymous):

Thanks it wasn't hard. I over think things way to much. THANK YOU MUCH FOR SAYING NOT TO GIVE UP.

OpenStudy (konradzuse):

it happens, sometimes you burn yourself out and need to put it down for the day/week etc. Sometimes picking up a new project also helps. Giving up on something you spent time on is no fun. glad you fixed it, sorry I wasn't able to help you with the code.. i'm not a python user.

Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!
Can't find your answer? Make a FREE account and ask your own questions, OR help others and earn volunteer hours!

Join our real-time social learning platform and learn together with your friends!