hda trigger a python script with a button..

   5420   2   0
User Avatar
Member
82 posts
Joined: Oct. 2007
Offline
Hello,
I run a python script with a button and I would like to know the way to catch the name of the button used . I need to parse this name in the script.
Help is welcome.

Tky.
User Avatar
Member
401 posts
Joined:
Offline
You could pass kwargs to you call back script:

hou.pwd().hdaModule().returnKWARGS(kwargs)

this dictionary contains useful information and also the name of the button pressed:

def returnKWARGS(me):
print me

{'node': <hou.ObjNode of type rdg_kwargs_test at /obj/subnet1>, ‘script_value0’: ‘1’, ‘parm’: <hou.Parm action in /obj/subnet1>, ‘script_value’: ‘1’, ‘script_parm’: ‘action’, ‘parm_n
ame’: ‘action’}

Maybe there is a more straight forward way.
this is not a science fair.
User Avatar
Member
338 posts
Joined: Sept. 2006
Offline
Rdg is basicaly there with what hes saying. Though If memory serves me correctly, i also asked this awhile back. I was told easiest way to grab the button name directly was to use

kwargs

so if the this was your defintion

def printButtonName(buttonName):
print buttonName

in your python call back place

testMyButton.printButtonName( kwargs)

Worked for me when using multiparms and generating folders based on a multiparm button and multiparm file path parameter

Hope this helps
Nick
  • Quick Links