width

width#

Variable that stores the width of the display window.

Examples#

example picture for width

def setup():
    py5.no_stroke()
    py5.background(0)
    py5.rect(0, 40, py5.width, 20)
    py5.rect(0, 60, py5.width//2, 20)

Description#

Variable that stores the width of the display window. This value is set by the first parameter of the size() function. For example, the function call size(320, 240) sets the width variable to the value 320. The value of width defaults to 100 if size() is not used in a program.

Underlying Processing field: width

Updated on December 07, 2024 22:07:08pm UTC