Friday, September 5, 2025
HomeLanguagesturtle.window_height() function in Python

turtle.window_height() function in Python

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.window_height()

This function is used to return the height of the turtle window. It doesn’t require any argument.

Syntax :

turtle.window_height()

Below is the implementation of the above method with an example :

Python3




# import package
import turtle
  
# get turtle window height
print(turtle.window_height())
  
# make screen object
# then set size and color
sc = turtle.Screen()
sc.setup(300,300)
sc.bgcolor("green")
  
# get turtle window height
print(turtle.window_height())
  
# loops for pass time
for i in range(5000):
  for j in range(5000):
    pass
  
# set size and color again
sc.setup(500,400)
sc.bgcolor("red")
  
# get turtle window height
print(turtle.window_height())


Output :

648
300
400
Dominic
Dominichttp://wardslaus.com
infosec,malicious & dos attacks generator, boot rom exploit philanthropist , wild hacker , game developer,
RELATED ARTICLES

Most Popular

Dominic
32264 POSTS0 COMMENTS
Milvus
81 POSTS0 COMMENTS
Nango Kala
6634 POSTS0 COMMENTS
Nicole Veronica
11801 POSTS0 COMMENTS
Nokonwaba Nkukhwana
11863 POSTS0 COMMENTS
Shaida Kate Naidoo
6750 POSTS0 COMMENTS
Ted Musemwa
7025 POSTS0 COMMENTS
Thapelo Manthata
6701 POSTS0 COMMENTS
Umr Jansen
6718 POSTS0 COMMENTS