Python: When using Python turtle to draw a picture, the graphics window disappears after drawing, and there are several solutions to exit the window

1. The first method: add at the end of the program: turtle.exitonclick()

   This statement makes the program wait for the user to click on the interface before it can exit

2. The second method: add at the end of the program: turtle.mainloop()

  The sentence must be put to the last sentence, all the code after the sentence cannot be executed

3. The third method: add at the end of the program: turtle.done()

  The function of this statement is similar to mainloop().
————————————————
Copyright Statement: This article is the original article of the CSDN blogger "data_amateur", which follows the CC 4.0 BY-SA copyright agreement. Please attach the original source link and this statement for reprinting .
Original link: https://blog.csdn.net/lost0910/article/details/105022259/

Guess you like

Origin blog.csdn.net/jccc39/article/details/106033493