From 2516ccc2f8f7b07caa156cb61057aa276a7714b9 Mon Sep 17 00:00:00 2001 From: Mathieu Virbel Date: Sun, 28 Oct 2012 17:30:21 +0100 Subject: [PATCH] widget: enhance the documentation of Widget to include more information / disclamer about the defaults of the Widget --- kivy/uix/widget.py | 20 ++++++++++++++++++++ 1 file changed, 20 insertions(+) diff --git a/kivy/uix/widget.py b/kivy/uix/widget.py index 7739922bf..d38cbbfbc 100644 --- a/kivy/uix/widget.py +++ b/kivy/uix/widget.py @@ -33,6 +33,24 @@ Our widget class is designed with a couple of principles in mind: You can also check if a widget collides with another widget with :meth:`Widget.collide_widget`. + +We also have some defaults that you should be aware of: + +* A :class:`Widget` is not a :class:`Layout`: it will not change the position + nor the size of its children. If you want a better positionning / sizing, use + a :class:`Layout`. + +* The default size is (100, 100), if the parent is not a :class:`Layout`. For + example, adding a widget inside a :class:`Button`, :class:`Label`, will not + inherit from the parent size or pos. + +* The default size_hint is (1, 1). If the parent is a :class:`Layout`, then the + widget size will be the parent/layout size. + +* All the :meth:`Widget.on_touch_down`, :meth:`Widget.on_touch_move`, + :meth:`Widget.on_touch_up` doesn't do any sort of collisions. If you want to + know if the touch is inside your widget, use :meth:`Widget.collide_point`. + Using Properties ---------------- @@ -54,6 +72,8 @@ widget moves, you can bind your own callback function like this:: wid = Widget() wid.bind(pos=callback_pos) +Read more about the :doc:`/api-kivy.properties`. + ''' __all__ = ('Widget', 'WidgetException')