Python – turtle.bye()
The turtle module provides turtle graphics primitives, in both object-oriented and procedure-oriented ways. Because it uses tkinter for the underlying graphics, it needs a version of Python installed with Tk support.
turtle.bye()
This function is used to shut the turtle graphics window. It doesn’t require any argument.
Syntax : turtle.bye()
Parameters : None
Returns : Nothing
Below is the implementation of above method with some examples :
Example 1:
# import packageimport turtle # set turtle speed to # slowest for better# understandings turtle.speed(1)# motion turtle.forward(200)# use bye() method to # shut the windowturtle.bye() |
Output :
Example 2 :
# import packageimport turtle # set drawing turtle speedturtle.speed(10) # loop for patternfor i in range(12): turtle.circle(50) turtle.right(30) # As simply use of bye() here will shut the # turtle graphics window too fast so use # loops to pass the timefor i in range(2000): for j in range(500): pass # shut the turtle graphics windowturtle.bye() |
Output :






Please Login to comment...