Jump to content

Switch Radio Button in Python


gemini

Recommended Posts

Hi Szalbolcs, I am python newbie, so there is probably better solution. I wanted to switch Tabs (which is just different type of folder, Radio Buttons are also type of folder) with python. I solved it like this:

- add new int parm (invisible)
- add expression, reference the name of the first Tab (add "1" to the name)
- switch that new int parm
- Tabs get synced, as "side effect"

Maybe you will find a better solution. Otherwise, here is mine. Attached is .py doing all these steps.

 

EDIT: btw for some reason, the initial naming of Tabs (when the node is created) is "wrong" and gets updated as soon as you read (or update) the UI. So, in my code, I start by addSpareParmTuple() and then ask for the Tab name. This is some Houdini thing, which I don't understand. You may try to read parmTemplateGroup() entries() on a new node twice. The second time, folder names are different, updated. Then they stay like this.

 

folders.PNG

folders.py

Edited by ikoon
Link to comment
Share on other sites

Thanks,  it can NOT work for me but unfortunately I can not modify the parameters now.

That's not mine. But i don't think ther is no other way to switch between radio buttons.  Any other idea?

THX

Edited by gemini
Link to comment
Share on other sites

you just need to know the name of the first radio button folder

then for some reason append 1 to its name to be able to access it 

so if your folder is called 'folder', then you access it as yournode.parm('folder1')

if the name is 'folder1' , then you access it as yournode.parm('folder11')

that being said, to switch the radio button you just set the value on such parm, , then you switch it as yournode.parm('folder1').set(2)

to try this out place Fuse SOP (let's say it's in '/obj/geo1/fuse1')
 

fuse = hou.node('/obj/geo1/fuse1')
fuse.parm('switcher1').set(1)

 

  • Like 1
  • Thanks 1
Link to comment
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.
Note: Your post will require moderator approval before it will be visible.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...