I have a program that uses turtle graphics. The problem is I have a game loop but don’t know where to put the mainloop function. If I put it before the game loop then game loop won't get executed. If I put it after mainloop will never get executed because the game loop is an infinite loop. Lastly if I put mainloop in game loops end than game loop will only get executed once. Where should I put mainloop?
import turtle
#some turtle code
while True:
#some code
turtle.mainloop
while Trueis blocking forever? So no matter where you put it, all the code beneath it will not be reached. This is both true for the example you pasted as for the example where the loop is inside the mainloop.