Quick search

Table Of Contents

Sandbox

New in version 1.8.0.

Warning

This is experimental and subject to change as long as this warning notice is present.

This is a widget that runs itself and all of its children in a Sandbox. That means if a child raises an Exception, it will be caught. The Sandbox itself runs its own Clock, Cache, etc.

The SandBox widget is still experimental and required for the Kivy designer. When the user designs their own widget, if they do something wrong (wrong size value, invalid python code), it will be caught correctly without breaking the whole application. Because it has been designed that way, we are still enhancing this widget and the kivy.context module. Don’t use it unless you know what you are doing.

class kivy.uix.sandbox.Sandbox(**kwargs)[source]

Bases: kivy.uix.floatlayout.FloatLayout

Sandbox widget, used to trap all the exceptions raised by child widgets.

on_context_created()[source]

Override this method in order to load your kv file or do anything else with the newly created context.

on_exception(exception, _traceback=None)[source]

Override this method in order to catch all the exceptions from children.

If you return True, it will not reraise the exception. If you return False, the exception will be raised to the parent.

on_touch_down(touch)

Receive a touch down event.

Parameters:
touch: MotionEvent class

Touch received. The touch is in parent coordinates. See relativelayout for a discussion on coordinate systems.

Returns:

bool If True, the dispatching of the touch event will stop. If False, the event will continue to be dispatched to the rest of the widget tree.

on_touch_move(touch)

Receive a touch move event. The touch is in parent coordinates.

See on_touch_down() for more information.

on_touch_up(touch)

Receive a touch up event. The touch is in parent coordinates.

See on_touch_down() for more information.