Skip to main content

Querying Dimensions

For querying the dimensions of the screen, font and terminal.

Screen Dimensions

screenWidth

Get the width of the screen.

width = screenWidth()
ReturnTypeNote
widthnumberin pixels.

screenHeight

Get the height of the screen.

height = screenHeight()
ReturnTypeNote
heightnumberin pixels.

screenSize

Get the dimensions of the screen.

width, height = screenSize()
ReturnTypeNote
widthnumberin pixels.
heightnumberin pixels.

Font Character Dimensions

fontWidth

Get the width of the font character in pixels.

width = fontWidth()
ReturnTypeNote
widthnumberin pixels.

fontHeight

Get the height of the font character in pixels.

height = fontHeight()
ReturnTypeNote
heightnumberin pixels.

fontSize

Get the dimensions of the font character in pixels.

height, width = fontSize()
ReturnTypeNote
widthnumberin pixels.
heightnumberin pixels.

Terminal Dimensions

info

Custom fonts can change the output values.

termWidth

Get the width of the terminal in characters.

w = termWidth()
ReturnTypeNote
widthnumberin characters.

termHeight

Get the height of the terminal in characters.

height = termHeight()
ReturnTypeNote
heightnumberin characters.

termSize

Get the size of the terminal in characters.

w, h = termSize()
ReturnTypeNote
widthnumberin characters.
heightnumberin characters.