2.2.7. Jittering an Existing Layout (layout.managers.jitter)

class layout.managers.jitter.JitterLM(angle_jitter=0.1, x_jitter=5.0, y_jitter=5.0, element=None)

Bases: layout.managers.jitter._JitterBase

Displays its managed element slightly offset from its reserved space.

The layout manager reserves the minimum space needed for its child element, but when it comes to draw the element, it draws it offset from its natural position, and slightly at an angle. The jitter parameters are given to the layout manager when it is constructed.

See RandomJitterLM for a manager that randomizes the jitter applied.

get_minimum_size(data)

How small can the element be? Should return a Point.

render(rectangle, data)

Asks the element to render itself.

class layout.managers.jitter.RandomJitterLM(max_angle_jitter=0.1, max_x_jitter=5.0, max_y_jitter=5.0, element=None)

Bases: layout.managers.jitter.JitterLM

A Jitter layout manager that chooses a random jitter binomially distributed around 0, and with half-size equal to the given parameters.

Note this layout manager does not randomize its offset each time it is called on to draw its content, only when it is constructed. The jitter is therefore consistent for the lifetime of an instance of this class.

class layout.managers.jitter.UnstableRandomJitterLM(max_angle_jitter=0.1, max_x_jitter=5.0, max_y_jitter=5.0, element=None)

Bases: layout.managers.jitter._JitterBase

A random jitter layout manager that does rerandomize its offsets each time it is called to render. Rendering the tree twice, therefore, may lead to different results.

get_minimum_size(data)

How small can the element be? Should return a Point.

render(rect, data)

Asks the element to render itself.