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 package import turtle # set turtle speed to # slowest for better # understandings turtle.speed( 1 ) # motion turtle.forward( 200 ) # use bye() method to # shut the window turtle.bye() |
Output :
Example 2 :
# import package import turtle # set drawing turtle speed turtle.speed( 10 ) # loop for pattern for 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 time for i in range ( 2000 ): for j in range ( 500 ): pass # shut the turtle graphics window turtle.bye() |
Output :
<!–
–>
Please Login to comment…