Quick search

Table Of Contents

Scatter Layout

New in version 1.6.0.

This layout allows you to set relative coordinate for children. If you want absolute positioning, check FloatLayout.

The ScatterLayout class behaves just like the regular Float Layout, except that its child widgets are positioned relative to the layout.

For example, if you create a ScatterLayout, add a widgets with position = (0,0), the child widget will also move, when you change the position of the ScatterLayout. The child widgets coordiantes remain (0,0), i.e. they are relative to the containing layout. Since ScatterLayout is implemented using a Scatter widget, you can also translate and scale the layout like a normal Scatter widget, and the child widgets will behave as expected.

..note:

The :class:`ScatterLayout` is implemented as a :class`FloatLayout`
inside a :class:`Scatter`.

Warning

Since the actual ScatterLayout is a Scatter, its add_widget and remove_widget functions are overwritten to add children to the embedded FloatLayout (accessible as content property of RelativeLayout) automatically. So if you want to access the added child elements, you need self.content.children, instead of self.children.

Warning

The :class:’ScatterLayout’ was introduced in 1.7.0 and was called :class:’~kivy.uix.relativelayout.RelativeLayout’ in prior versions. :class:’~kivy.uix.relativelayout.RelativeLayout’ is now an optimized implementation that uses only a positional transform, to avoid some of the heavier calculation involved form Scatter.

class kivy.uix.scatterlayout.ScatterLayout(**kw)

Bases: kivy.uix.scatter.Scatter

RelativeLayout class, see module documentation for more information.