Skip to content

Python in Touch

Here is a collection of python commands that can be util learning and applying:

# comment text out

Variables

//Basic variables
var1 = 10.0
var2 = 20
var3 = "String"

//Converting Variables
str(var1) // float into string

Grab values from operator

op('opname')['nameChannel']
op('opname')[0]

//Always useful to assign operator to variable
op = op('lfo1')

Conditions

if var1 >=0:
    # Do something
else:
    # Do something else


if var1 == 0 && var3 < 3:

Loops

For-Loop

for x in range(0,10):
    print(x)

While loop

!!! Python will stop touchdesigner while the while loop runs.

while var <=0:
    print(x)

Access Parameter

op = op('lfo1')
op.par.parameterName

Comments