Skip to content
Related Articles

Related Articles

turtle.window_height() function in Python
  • Last Updated : 26 Jul, 2020

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



filter_none

edit
close

play_arrow

link
brightness_4
code

# 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())

chevron_right


Output :

648
300
400

Attention geek! Strengthen your foundations with the Python Programming Foundation Course and learn the basics.

To begin with, your interview preparations Enhance your Data Structures concepts with the Python DS Course.

My Personal Notes arrow_drop_up
Recommended Articles
Page :