Python Forum
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Grid_Destory() Not Working
#5
(Mar-04-2021, 02:05 PM)deanhystad Wrote: You should not have sleep commands in a GUI application. They prevent mainloop from running and stop window updates.

Instead of this:
print("The game will now terminate")
time.sleep(3)
window_4.destroy()
try this
print("The game will now terminate")
root.after(3000, quit)
You have 9 nearly identical functions. Can you think of a way to make 1 function work for all 9 buttons?

Thanks for the help, that has sort of resolved the issue. Now instead when I press the final button it now just closes the program with no pause. SO when there is one life left and I get it incorrect, the window just closes instantly.

When coding it I did think of a way to try and combine them but couldn't think of any of them because they are all for separate buttons and all set a variable to a different number depending on what button is clicked. If there is a way for it to know hcih button has been pressed then I might be able to.
Reply


Messages In This Thread
Grid_Destory() Not Working - by finndude - Mar-03-2021, 06:53 PM
RE: Grid_Destory() Not Working - by bowlofred - Mar-03-2021, 09:18 PM
RE: Grid_Destory() Not Working - by finndude - Mar-04-2021, 09:43 AM
RE: Grid_Destory() Not Working - by deanhystad - Mar-04-2021, 02:05 PM
RE: Grid_Destory() Not Working - by finndude - Mar-04-2021, 02:18 PM
RE: Grid_Destory() Not Working - by deanhystad - Mar-04-2021, 03:21 PM
RE: Grid_Destory() Not Working - by finndude - Mar-04-2021, 05:11 PM

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020