mirror of https://github.com/kivy/kivy.git
widget: enhance the documentation of Widget to include more information / disclamer about the defaults of the Widget
This commit is contained in:
parent
7b3b209f43
commit
2516ccc2f8
|
@ -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')
|
||||
|
|
Loading…
Reference in New Issue