# NodeBox

Create visual output with Python programming code
Home Download Reference Tutorial Library Gallery About

# Reference | size()

Syntax |
    size(w, h)
Description | Sets the size of the canvas in points. The first parameter sets the width, the second parameter the height. If this command is used, it should be the first line in a script - it's illogical to set the size of the canvas halfway a script! The supplied values can be multiplied by "inch", "cm" or "mm". The WIDTH and HEIGHT constants can be used to obtain the canvas size.
Example |
    size(400, 600)
    # the canvas is 400 X 600 points
    print WIDTH # prints 400
    print HEIGHT # prints 600
    size(20*cm, 20*cm)
    # the canvas is 20 x 20 cm