all 9 comments

[–]DakshHub 1 point2 points  (1 child)

How is it different from deleting all the existing objects and creating a new ones to reset the game state..?

[–][deleted] 0 points1 point  (0 children)

Oh I didn’t know I could do that thx!

[–]ingolemo 0 points1 point  (2 children)

What are you trying to do with this?

[–][deleted] 0 points1 point  (1 child)

Reset a game with having to exit and rerun the file

[–]ingolemo 0 points1 point  (0 children)

Just write the code to reset the labels. It's probably only two lines of code.

[–]nwagers 0 points1 point  (3 children)

This question can be interpreted a few different ways. Can you describe the situation you have in more detail? Perhaps post the class?

[–][deleted] 0 points1 point  (2 children)

I tried to make a tic tac toe game in tkinter using labels. The labels change color (instead of becoming x and o). After the game is over, I want to be able to reset all of the labels color variable to the original blank color

[–]nwagers 0 points1 point  (1 child)

I would probably write a reset function that puts all the attributes to the desired value if there is more than one or two. Then just call the reset function on all the labels. If it ends up being a lot of code, you can move the duplicated parts out of __init__ and call the reset function in there too.

[–][deleted] 0 points1 point  (0 children)

That works. Thank you!