Hi,
We have the following code: add_child(Texts.TextImage[index])
add_child(Texts.TextImage[index])
How can we detect if a Child exists based on above code? Let us know, thanks!
Jesse
You already know it exists because you have a reference to it, you just have to keep track of that reference when you add it. Or get the children of the node you add it in and have a property you can check for and know is unique to the child you're looking for.
I think you can use == so:
for child in node.get_children(): if child == Texts.TextImage[index]: print("image found")
You'd have to set up a test to make sure.
Thank you for the info. I'll try that later today...
How can we detect if a Child exists based on above code?
Are you simply trying to verify that your code is working as designed?
Thanks for all the replies.
Purpose of detecting if text Child exists is to reuse a text. We sometimes need to change the texts text and don't want to just create a new text.
Thanks!