You are here: User Guide > Nuke > Configuring Nuke > Setting Default Values for Controls

Setting Default Values for Controls

You can set default values for node controls by adding a simple line of Python to your init.py file. Once a default value is set, all controls with matching names default to this value. For example, you can set default values for file format specific controls in the Read, Write or other file format-dependent nodes. To set a default value, use the following statement:

nuke.knobDefault()

To specify file format specific defaults, use the class name, followed by the file format extension and the control name, all separated by periods. For example:

nuke.knobDefault("Read.exr.compression", "2")

Maybe you want the last frame value of the frame range controls in the Project Settings to default to frame 200. To do this, use the following statement:

nuke.knobDefault("Root.last_frame", "200")