Tuesday, September 24, 2024
Google search engine
HomeLanguagesPython – turtle.bye()

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 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 :

Last Updated :
17 Aug, 2020
Like Article
Save Article

<!–

–>

Similar Reads
Related Tutorials
Dominic Rubhabha-Wardslaus
Dominic Rubhabha-Wardslaushttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Recent Comments