Show/Hide button based on value of tag

Hello!

I have a button that should be hidden unless the value of a tag is greater than 0. This is the script I have on the onCompositionEnd event:
image
Not too sure how to move forward from here, any help would be great!

Thank you!

I would create a custom property bound to the tag, then use an expression on the visible/display property of the button.

2 Likes

Should I create the custom property on the button that I want hidden or the field with the tag data?

I guess that depends on if the custom property will be used elsewhere. I think I would place in the root of the view the button will be. There are several ways to approach this.

1 Like

You are making this too hard. Just use a tag binding on meta.visible to that tag. Non-zero automatically maps to true.

2 Likes

Welp, you are definitely right on that! I was making it way too difficult, binding it to that tags value did the trick! Thank you both for the help!

1 Like

Tips:
Your (now redundant) code should use .visible = False and .visible = True for Python boolean.

Posting code is better than pictures of code as we can copy and edit it in our answers. Use the </> code formatting button when posting code.

1 Like

Will do, thank you for the valuable feedback!