Container

Container is the top level of the layer hierarchy. You will never need to create a Container on your own, however you may wish to manipulate its properties, especially the sublayer geometry properties.

Topics

Discussion

Properties

Refer to the properties concepts section for an overview of properties.

setPropertiesByName(properties, **kwargs)

Set the value of multiple properties by name.

setPropertyByName(name, value, **kwargs)

Set property name with value.

propertyGroup([name, duration, timing, …])

Create a context manager that allows setting multiple properties in an efficient way.

Identification

getName([makeIfNeeded])

Get the name assigned to this layer during __init__.

setInfoValue(key, value)

Set key : value in this layer’s info dictionary.

getInfoValue(key[, fallback])

Set key from the arbitrary info dictionary.

Transformations

Container.getContainerTransformation()

Get the transformation that applies to all sublayers in the container.

Container.setContainerTransformation(transformation)

Set the transformation that applies to all sublayers in the container.

container.appendBaseSublayer(
    position=(50, 50),
    size=(400, 100),
    backgroundColor=(1, 0, 0, 1)
)
container.setContainerTransformation((0.5, 0, 0, 0.5, 100, 100))
Container.getContainerScale()

Get the scale that applies to all sublayers.

Container.setContainerScale(scale)

Set the scale that applies to all sublayers.

container.appendBaseSublayer(
    position=(50, 50),
    size=(400, 100),
    backgroundColor=(1, 0, 0, 1)
)
container.setSublayerScale(0.5)

addSublayerTransformation(transformation, name)

Add a transformation with name that applies to all of this layer’s sublayers.

removeSublayerTransformation(name)

Remove the transformation with name.

addSublayerTranslationTransformation(value)

Add a sublayer translate transformation with name.

addSublayerScaleTransformation(value[, …])

Add a sublayer scale transformation with name and center.

addSublayerRotationTransformation(value[, …])

Add a sublayer scale transformation with name and center.

addSublayerSkewTransformation(value[, name, …])

Add a sublayer skew transformation with name and center.

Frame

getVisible()

Get if the layer is visible.

setVisible(value)

Set if the layer is visible.

getMaskToFrame()

Get if the layer hides any sublayer data outside of its frame.

setMaskToFrame(value)

set if the layer hides any sublayer data outside of its frame.

getOpacity()

Get the opacity of this layer.

setOpacity(value)

Set the opacity of this layer,

getBackgroundColor()

Get the background color for this layer.

setBackgroundColor(color)

Set the background color for this layer.

getBorderColor()

Get the border color for this layer.

setBorderColor(color)

Set the border color for this layer.

getBorderWidth()

Get the border width for this layer.

setBorderWidth(value)

Set the border width for this layer.

getCornerRadius()

Get this corner radius of this layer.

setCornerRadius(value)

Set the corner radius of this layer.

Shadow

getShadowColor()

Get the shadow color for this layer.

setShadowColor(color)

Set the shadow color for this layer.

getShadowOpacity()

Get the shadow opacity for this layer.

setShadowOpacity(value)

Set the shadow opacity for this layer.

getShadowOffset()

Get the shadow offset for this layer.

setShadowOffset(offset)

Set the shadow offset for this layer.

getShadowBlurRadius()

Get the shadow blur radius for this layer.

setShadowBlurRadius(value)

Set the shadow blur radius for this layer.

Filters

Refer the filter documentation in Base for complete details.

getCompositingMode()

Set the compositing filter for the layer.

setCompositingMode(filterType)

Set the compositing filter for the layer.

getFilters()

Get a list of the filters for this layer.

setFilters(allFilterSettings)

Set a list of the filters for this layer.

appendFilter(filterSettings)

Append a filter to this layer.

getFilter(name)

Get the filter with name from this layer.

removeFilter(name)

Remove the filter with name from this layer.

clearFilters()

Clear all background filters from this layer.

getBackgroundFilters()

Get a list of the background filters for this layer.

setBackgroundFilters(allFilterSettings)

Set a list of the background filters for this layer.

appendBackgroundFilter(filterSettings)

Append a background filter to this layer.

getBackgroundFilter(name)

Get the background filter with name from this layer.

removeBackgroundFilter(name)

Remove the background filter with name from this layer.

Animation

Refer to the animation concepts section for an overview of animation.

clearAnimation()

Remove all animations from this layer.

stopAnimation(name)

Stop the animation with the name given when the animation was created with a property group.

isAnimationPaused()

Get if animation is currently paused for this layer.

pauseAnimation()

Pause the animation of this layer.

resumeAnimation()

Resume the animation of the layer.

Sublayers

Refer to the layer hierarchy concepts section for an overview of sublayers.

sublayerGroup([sublayers])

Place a hold on adding the sublayers to this layer’s CALayer until the context manager exits.

getSublayers()

Get all sublayers within this layer.

getSublayer(name)

Get the sublayer with name.

clearSublayers()

Remove all sublayers within this layer.

removeSublayer(sublayer)

Remove the given sublayer from the layer.

appendSublayer(sublayer)

Append an instantiated sublayer to this layer.

appendSublayerOfClass(layerClass, **kwargs)

Append a sublayer to this layer.

appendBaseSublayer(**kwargs)

Append a base layer.

appendPathSublayer(**kwargs)

Append a path layer.

appendLineSublayer(**kwargs)

Append a line layer.

appendOvalSublayer(**kwargs)

Append a oval layer.

appendRectangleSublayer(**kwargs)

Append a rectangle layer.

appendImageSublayer(**kwargs)

Append an image layer.

appendTextBoxSublayer(**kwargs)

Append a text box.

appendTextLineSublayer(**kwargs)

Append a text line.

appendSymbolSublayer(**kwargs)

Append a symbol.

drawingTools([clear])

This creates a context manager that provides a sublayer creation syntax that supports a subset of the DrawBot API.

Superlayers

Refer to the layer hierarchy concepts section for an overview of superlayers.

getContainer()

Get the Container that this layer belongs to.

getSuperlayer()

Get the layer that this layer belongs to.

Hit Testing

CoreAnimation Object

getCALayer()

Get the CALayer that this object wraps.