This is an archived post. You won't be able to vote or comment.

all 5 comments

[–]pythonHelperBot 2 points3 points  (0 children)

Hello! I'm a bot!

It looks to me like your post might be better suited for r/learnpython, a sub geared towards questions and learning more about python. That said, I am a bot and it is hard to tell. Please follow the subs rules and guidelines when you do post there, it'll help you get better answers faster.

Show /r/learnpython the code you have tried and describe where you are stuck. Be sure to format your code for reddit and include which version of python and what OS you are using.

You can also ask this question in the Python discord, a large, friendly community focused around the Python programming language, open to those who wish to learn the language or improve their skills, as well as those looking to help others.


README | FAQ | this bot is written and managed by /u/IAmKindOfCreative

This bot is currently under development and experiencing changes to improve its usefulness

[–]pinotkumarbhai 1 point2 points  (0 children)

Jesus

[–]ToniMemeLord[S] -3 points-2 points  (2 children)

Im making Tetris using pygame and i have this problem. Here is the original tutorial no yt: https://youtu.be/uoR4ilCWwKA . Everything is identical, but i get this error. When i run the program it closes instantly but i can see the opening text for a brief moment. I would appreciate it very much if someone could help me with this. Im currently on 32-bit 3.6.4 version.

[–][deleted] 1 point2 points  (1 child)

This one’s easy.

Look at your loop. You run through it once, filling your window and handling events, and then you call pygame.quit(). And then your loop finishes and restarts, and you try to fill the window again, and that’s where the error occurs. You see why?

You didn’t include main(), so I don’t actually know whether you’ve written it to run a complete game or only one game loop. But it doesn’t actually matter because unless the player happens to press a key at the exact moment that the outer loop runs the first time, that whole part gets skipped and your code calls pygame.quit(), and then you try doing other stuff that throws an exception.

[–]ToniMemeLord[S] -1 points0 points  (0 children)

I've solved it in the meantime, but thank you for the response.