python touchdesigner的Python-switch语句,更好
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了python touchdesigner的Python-switch语句,更好相关的知识,希望对你有一定的参考价值。
def switcher(func_name, val1, val2):
functions = {
"Add" : Add,
"Subtract" : Subtract,
"Multiply" : Multiply,
"Divide" : Divide
}
active_function = functions.get(func_name)
result = active_function(val1, val2)
return result
def Add(val1, val2):
sum_val = val1 + val2
return sum_val
def Subtract(val1, val2):
sum_val = val1 - val2
return sum_val
def Multiply(val1, val2):
sum_val = val1 * val2
return sum_val
def Divide(val1, val2):
sum_val = val1 / val2
return sum_val
print( switcher("Subtract", 1, 2) )
以上是关于python touchdesigner的Python-switch语句,更好的主要内容,如果未能解决你的问题,请参考以下文章
python touchdesigner的Python-switch语句好
python touchdesigner的Python-switch语句最差
python 使用自定义环境值启动TouchDesigner
python touchdesigner-通用代码分割-jobEXT-示例
python touchdesigner-通用代码分割-generalEXT-示例
python 怎么,不至延迟功能于TouchDesigner