Vision: Get a collection of all Containers

I have a Window with Root Container, and then 4 sub-containers nested inside of the root container. There are also some other components in the Root Container that I do NOT want to include. Is there an easy way to get a collection of all the sub-containers and loop through them to set some properties?

from com.inductiveautomation.factorypmi.application.components import BasicContainer

for component in rootContainer.components:
	if isinstance(component, BasicContainer):
		pass # it's a container
	else:
		pass # it's some other type of component
4 Likes

Worked like a charm... how about setting the x,y coordinate of said sub-containers relative to the rootContainer?

You would need to use the system.gui.transform() to modify position or size at runtime.

1 Like