doc: revisions to uix/button.py

This commit is contained in:
Richard Larkin 2013-09-14 21:52:28 +02:00
parent a663579e77
commit 5edcdc0aa0
1 changed files with 25 additions and 25 deletions

View File

@ -5,8 +5,8 @@ Button
.. image:: images/button.jpg .. image:: images/button.jpg
:align: right :align: right
:class:`Button` is a :class:`~kivy.uix.label.Label` with associated actions that The :class:`Button` is a :class:`~kivy.uix.label.Label` with associated actions
are triggered when the button is pressed (or released after a click/touch). that are triggered when the button is pressed (or released after a click/touch).
To configure the button, you can use the same properties that you can use for To configure the button, you can use the same properties that you can use for
the Label class:: the Label class::
@ -23,7 +23,7 @@ To attach a callback when the button is pressed (clicked/touched), use
btn2 = Button(text='Hello world 2') btn2 = Button(text='Hello world 2')
btn2.bind(on_press=callback) btn2.bind(on_press=callback)
If you want to be notified every time the button state changes, you can attach If you want to be notified every time the button state changes, you can bind
to the :data:`Button.state` property:: to the :data:`Button.state` property::
def callback(instance, value): def callback(instance, value):
@ -44,7 +44,7 @@ class Button(ButtonBehavior, Label):
.. versionchanged:: 1.8.0 .. versionchanged:: 1.8.0
The behavior / logic of the button has been moved into a The behavior / logic of the button has been moved to
:class:`~kivy.uix.behaviors.ButtonBehaviors`. :class:`~kivy.uix.behaviors.ButtonBehaviors`.
''' '''
@ -54,63 +54,63 @@ class Button(ButtonBehavior, Label):
.. versionadded:: 1.0.8 .. versionadded:: 1.0.8
:data:`background_color` is a :class:`~kivy.properties.ListProperty`, The :data:`background_color` is a :class:`~kivy.properties.ListProperty` and
default to [1, 1, 1, 1]. defaults to [1, 1, 1, 1].
''' '''
background_normal = StringProperty( background_normal = StringProperty(
'atlas://data/images/defaulttheme/button') 'atlas://data/images/defaulttheme/button')
'''Background image of the button used for default graphical representation, '''Background image of the button used for the default graphical
when the button is not pressed. representation when the button is not pressed.
.. versionadded:: 1.0.4 .. versionadded:: 1.0.4
:data:`background_normal` is an :class:`~kivy.properties.StringProperty`, :data:`background_normal` is a :class:`~kivy.properties.StringProperty`
default to 'atlas://data/images/defaulttheme/button' and defaults to 'atlas://data/images/defaulttheme/button'.
''' '''
background_down = StringProperty( background_down = StringProperty(
'atlas://data/images/defaulttheme/button_pressed') 'atlas://data/images/defaulttheme/button_pressed')
'''Background image of the button used for default graphical representation, '''Background image of the button used for the default graphical
when the button is pressed. representation when the button is pressed.
.. versionadded:: 1.0.4 .. versionadded:: 1.0.4
:data:`background_down` is an :class:`~kivy.properties.StringProperty`, :data:`background_down` is a :class:`~kivy.properties.StringProperty` and
default to 'atlas://data/images/defaulttheme/button_pressed' defaults to 'atlas://data/images/defaulttheme/button_pressed'.
''' '''
background_disabled_normal = StringProperty( background_disabled_normal = StringProperty(
'atlas://data/images/defaulttheme/button_disabled') 'atlas://data/images/defaulttheme/button_disabled')
'''Background image of the button used for default graphical representation, '''Background image of the button used for the default graphical
when the button is not pressed. representation when the button is not pressed.
.. versionadded:: 1.8.0 .. versionadded:: 1.8.0
:data:`background_normal` is an :class:`~kivy.properties.StringProperty`, :data:`background_normal` is a :class:`~kivy.properties.StringProperty` and
default to 'atlas://data/images/defaulttheme/button_disabled' defaults to 'atlas://data/images/defaulttheme/button_disabled'.
''' '''
background_disabled_down = StringProperty( background_disabled_down = StringProperty(
'atlas://data/images/defaulttheme/button_disabled_pressed') 'atlas://data/images/defaulttheme/button_disabled_pressed')
'''Background image of the button used for default graphical representation, '''Background image of the button used for the default graphical
when the button is pressed. representation when the button is pressed.
.. versionadded:: 1.8.0 .. versionadded:: 1.8.0
:data:`background_down` is an :class:`~kivy.properties.StringProperty`, :data:`background_down` is a :class:`~kivy.properties.StringProperty` and
default to 'atlas://data/images/defaulttheme/button_disabled_pressed' defaults to 'atlas://data/images/defaulttheme/button_disabled_pressed'.
''' '''
border = ListProperty([16, 16, 16, 16]) border = ListProperty([16, 16, 16, 16])
'''Border used for :class:`~kivy.graphics.vertex_instructions.BorderImage` '''Border used for :class:`~kivy.graphics.vertex_instructions.BorderImage`
graphics instruction. Used with :data:`background_normal` and graphics instruction. Used with :data:`background_normal` and
:data:`background_down`. Can be used for a custom background. :data:`background_down`. Can be used for custom backgrounds.
It must be a list of four values: (top, right, bottom, left). Read the It must be a list of four values: (top, right, bottom, left). Read the
BorderImage instruction for more information about how to use it. BorderImage instruction for more information about how to use it.
:data:`border` is a :class:`~kivy.properties.ListProperty`, default to (16, :data:`border` is a :class:`~kivy.properties.ListProperty` and defaults to
16, 16, 16) (16, 16, 16, 16)
''' '''