We are currently solving the following issue within our repository. Here is the issue text:
--- BEGIN ISSUE ---
Crash when Slider is imported before forking process on Mac OS X
Consider

```
#!/usr/bin/env python2
import multiprocessing
from kivy.app import App

from kivy.uix.slider import Slider

class Test(App):
    def build(self):
        return Slider()

def run_app():
    app = Test()
    app.run()

running_app = multiprocessing.Process(target=run_app)
running_app.daemon = True
running_app.start()
running_app.join()
```

This currently crashes on Mac OS X:

> **\* multi-threaded process forked ***
> crashed on child side of fork pre-exec
> USING_FORK_WITHOUT_EXEC_IS_NOT_SUPPORTED_BY_FILE_MANAGER

This is because the property `padding` is initialized with `NumericProperty(sp(16))`. This call to `sp` will attempt to initialize SDL. Cf. [this question on StackOverflow](http://stackoverflow.com/questions/8106002/using-the-python-multiprocessing-module-for-io-with-pygame-on-mac-os-10-7)


--- END ISSUE ---

Below are some code segments, each from a relevant file. One or more of these files may contain bugs.
--- BEGIN FILES ---
Path: `kivy/uix/slider.py`
Content:
```
1 """
2 Slider
3 ======
4 
5 .. image:: images/slider.jpg
6 
7 The :class:`Slider` widget looks like a scrollbar. It supports horizontal and
8 vertical orientations, min/max values and a default value.
9 
10 To create a slider from -100 to 100 starting from 25::
11 
12     from kivy.uix.slider import Slider
13     s = Slider(min=-100, max=100, value=25)
14 
15 To create a vertical slider::
16 
17     from kivy.uix.slider import Slider
18     s = Slider(orientation='vertical')
19 
20 """
21 __all__ = ('Slider', )
22 
23 from kivy.uix.widget import Widget
24 from kivy.properties import (NumericProperty, AliasProperty, OptionProperty,
25                              ReferenceListProperty, BoundedNumericProperty)
26 from kivy.metrics import sp
27 
28 
29 class Slider(Widget):
30     """Class for creating a Slider widget.
31 
32     Check module documentation for more details.
33     """
34 
35     value = NumericProperty(0.)
36     '''Current value used for the slider.
37 
38     :attr:`value` is a :class:`~kivy.properties.NumericProperty` and defaults
39     to 0.'''
40 
41     min = NumericProperty(0.)
42     '''Minimum value allowed for :attr:`value`.
43 
44     :attr:`min` is a :class:`~kivy.properties.NumericProperty` and defaults to
45     0.'''
46 
47     max = NumericProperty(100.)
48     '''Maximum value allowed for :attr:`value`.
49 
50     :attr:`max` is a :class:`~kivy.properties.NumericProperty` and defaults to
51     100.'''
52 
53     padding = NumericProperty(sp(16))
54     '''Padding of the slider. The padding is used for graphical representation
55     and interaction. It prevents the cursor from going out of the bounds of the
56     slider bounding box.
57 
58     By default, padding is sp(16). The range of the slider is reduced from
59     padding \*2 on the screen. It allows drawing the default cursor of sp(32)
60     width without having the cursor go out of the widget.
61 
62     :attr:`padding` is a :class:`~kivy.properties.NumericProperty` and defaults
63     to sp(16).'''
64 
65     orientation = OptionProperty('horizontal', options=(
66         'vertical', 'horizontal'))
67     '''Orientation of the slider.
68 
69     :attr:`orientation` is an :class:`~kivy.properties.OptionProperty` and
70     defaults to 'horizontal'. Can take a value of 'vertical' or 'horizontal'.
71     '''
72 
73     range = ReferenceListProperty(min, max)
74     '''Range of the slider in the format (minimum value, maximum value)::
75 
76         >>> slider = Slider(min=10, max=80)
77         >>> slider.range
78         [10, 80]
79         >>> slider.range = (20, 100)
80         >>> slider.min
81         20
82         >>> slider.max
83         100
84 
85     :attr:`range` is a :class:`~kivy.properties.ReferenceListProperty` of
86     (:attr:`min`, :attr:`max`) properties.
87     '''
88 
89     step = BoundedNumericProperty(0, min=0)
90     '''Step size of the slider.
91 
92     .. versionadded:: 1.4.0
93 
94     Determines the size of each interval or step the slider takes between
95     min and max. If the value range can't be evenly divisible by step the
96     last step will be capped by slider.max
97 
98     :attr:`step` is a :class:`~kivy.properties.NumericProperty` and defaults
99     to 1.'''
100 
101     # The following two methods constrain the slider's value
102     # to range(min,max). Otherwise it may happen that self.value < self.min
103     # at init.
104 
105     def on_min(self, *largs):
106         self.value = min(self.max, max(self.min, self.value))
107 
108     def on_max(self, *largs):
109         self.value = min(self.max, max(self.min, self.value))
110 
111     def get_norm_value(self):
112         vmin = self.min
113         d = self.max - vmin
114         if d == 0:
115             return 0
116         return (self.value - vmin) / float(d)
117 
118     def set_norm_value(self, value):
119         vmin = self.min
120         vmax = self.max
121         step = self.step
122         val = min(value * (vmax - vmin) + vmin, vmax)
123         if step == 0:
124             self.value = val
125         else:
126             self.value = min(round((val - vmin) / step) * step + vmin,
127                              vmax)
128     value_normalized = AliasProperty(get_norm_value, set_norm_value,
129                                      bind=('value', 'min', 'max', 'step'))
130     '''Normalized value inside the :attr:`range` (min/max) to 0-1 range::
131 
132         >>> slider = Slider(value=50, min=0, max=100)
133         >>> slider.value
134         50
135         >>> slider.value_normalized
136         0.5
137         >>> slider.value = 0
138         >>> slider.value_normalized
139         0
140         >>> slider.value = 100
141         >>> slider.value_normalized
142         1
143 
144     You can also use it for setting the real value without knowing the minimum
145     and maximum::
146 
147         >>> slider = Slider(min=0, max=200)
148         >>> slider.value_normalized = .5
149         >>> slider.value
150         100
151         >>> slider.value_normalized = 1.
152         >>> slider.value
153         200
154 
155     :attr:`value_normalized` is an :class:`~kivy.properties.AliasProperty`.
156     '''
157 
158     def get_value_pos(self):
159         padding = self.padding
160         x = self.x
161         y = self.y
162         nval = self.value_normalized
163         if self.orientation == 'horizontal':
164             return (x + padding + nval * (self.width - 2 * padding), y)
165         else:
166             return (x, y + padding + nval * (self.height - 2 * padding))
167 
168     def set_value_pos(self, pos):
169         padding = self.padding
170         x = min(self.right - padding, max(pos[0], self.x + padding))
171         y = min(self.top - padding, max(pos[1], self.y + padding))
172         if self.orientation == 'horizontal':
173             if self.width == 0:
174                 self.value_normalized = 0
175             else:
176                 self.value_normalized = (x - self.x - padding
177                                          ) / float(self.width - 2 * padding)
178         else:
179             if self.height == 0:
180                 self.value_normalized = 0
181             else:
182                 self.value_normalized = (y - self.y - padding
183                                          ) / float(self.height - 2 * padding)
184     value_pos = AliasProperty(get_value_pos, set_value_pos,
185                               bind=('x', 'y', 'width', 'height', 'min',
186                                     'max', 'value_normalized', 'orientation'))
187     '''Position of the internal cursor, based on the normalized value.
188 
189     :attr:`value_pos` is an :class:`~kivy.properties.AliasProperty`.
190     '''
191 
192     def on_touch_down(self, touch):
193         if self.disabled or not self.collide_point(*touch.pos):
194             return
195         if touch.is_mouse_scrolling:
196             if 'down' in touch.button or 'left' in touch.button:
197                 if self.step:
198                     self.value = min(self.max, self.value + self.step)
199                 else:
200                     self.value = min(
201                         self.max,
202                         self.value + (self.max - self.min) / 20)
203             if 'up' in touch.button or 'right' in touch.button:
204                 if self.step:
205                     self.value = max(self.min, self.value - self.step)
206                 else:
207                     self.value = max(
208                         self.min,
209                         self.value - (self.max - self.min) / 20)
210         else:
211             touch.grab(self)
212             self.value_pos = touch.pos
213         return True
214 
215     def on_touch_move(self, touch):
216         if touch.grab_current == self:
217             self.value_pos = touch.pos
218             return True
219 
220     def on_touch_up(self, touch):
221         if touch.grab_current == self:
222             self.value_pos = touch.pos
223             return True
224 
225 if __name__ == '__main__':
226     from kivy.app import App
227 
228     class SliderApp(App):
229         def build(self):
230             return Slider(padding=25)
231 
232     SliderApp().run()
233
```
--- END FILES ---

Please first localize the bug based on the issue statement, and then generate a patch according to the `git diff` format fenced by three backticks.

Here is an example:

```diff
diff --git a/examples/server_async.py b/examples/server_async.py
--- a/examples/server_async.py
+++ b/examples/server_async.py
@@ -313,4 +313,4 @@
 
 
 if __name__ == "__main__":
-    asyncio.run(run_async_server("."), debug=True)
+    asyncio.run(run_async_server(), debug=True)
diff --git a/examples/server_sync.py b/examples/server_sync.py
--- a/examples/server_sync.py
+++ b/examples/server_sync.py
@@ -313,5 +313,5 @@
 
 
 if __name__ == "__main__":
-    server = run_sync_server(".")
+    server = run_sync_server()
     server.shutdown()

```

diff --git a/kivy/uix/slider.py b/kivy/uix/slider.py
--- a/kivy/uix/slider.py
+++ b/kivy/uix/slider.py
@@ -23,7 +23,6 @@
 from kivy.uix.widget import Widget
 from kivy.properties import (NumericProperty, AliasProperty, OptionProperty,
                              ReferenceListProperty, BoundedNumericProperty)
-from kivy.metrics import sp
 
 
 class Slider(Widget):
@@ -50,17 +49,17 @@
     :attr:`max` is a :class:`~kivy.properties.NumericProperty` and defaults to
     100.'''
 
-    padding = NumericProperty(sp(16))
+    padding = NumericProperty('16sp')
     '''Padding of the slider. The padding is used for graphical representation
     and interaction. It prevents the cursor from going out of the bounds of the
     slider bounding box.
 
-    By default, padding is sp(16). The range of the slider is reduced from
-    padding \*2 on the screen. It allows drawing the default cursor of sp(32)
+    By default, padding is 16sp. The range of the slider is reduced from
+    padding \*2 on the screen. It allows drawing the default cursor of 32sp
     width without having the cursor go out of the widget.
 
     :attr:`padding` is a :class:`~kivy.properties.NumericProperty` and defaults
-    to sp(16).'''
+    to 16sp.'''
 
     orientation = OptionProperty('horizontal', options=(
         'vertical', 'horizontal'))

{"golden_diff": "diff --git a/kivy/uix/slider.py b/kivy/uix/slider.py\n--- a/kivy/uix/slider.py\n+++ b/kivy/uix/slider.py\n@@ -23,7 +23,6 @@\n from kivy.uix.widget import Widget\n from kivy.properties import (NumericProperty, AliasProperty, OptionProperty,\n                              ReferenceListProperty, BoundedNumericProperty)\n-from kivy.metrics import sp\n \n \n class Slider(Widget):\n@@ -50,17 +49,17 @@\n     :attr:`max` is a :class:`~kivy.properties.NumericProperty` and defaults to\n     100.'''\n \n-    padding = NumericProperty(sp(16))\n+    padding = NumericProperty('16sp')\n     '''Padding of the slider. The padding is used for graphical representation\n     and interaction. It prevents the cursor from going out of the bounds of the\n     slider bounding box.\n \n-    By default, padding is sp(16). The range of the slider is reduced from\n-    padding \\*2 on the screen. It allows drawing the default cursor of sp(32)\n+    By default, padding is 16sp. The range of the slider is reduced from\n+    padding \\*2 on the screen. It allows drawing the default cursor of 32sp\n     width without having the cursor go out of the widget.\n \n     :attr:`padding` is a :class:`~kivy.properties.NumericProperty` and defaults\n-    to sp(16).'''\n+    to 16sp.'''\n \n     orientation = OptionProperty('horizontal', options=(\n         'vertical', 'horizontal'))\n", "issue": "Crash when Slider is imported before forking process on Mac OS X\nConsider\n\n```\n#!/usr/bin/env python2\nimport multiprocessing\nfrom kivy.app import App\n\nfrom kivy.uix.slider import Slider\n\nclass Test(App):\n    def build(self):\n        return Slider()\n\ndef run_app():\n    app = Test()\n    app.run()\n\nrunning_app = multiprocessing.Process(target=run_app)\nrunning_app.daemon = True\nrunning_app.start()\nrunning_app.join()\n```\n\nThis currently crashes on Mac OS X:\n\n> **\\* multi-threaded process forked ***\n> crashed on child side of fork pre-exec\n> USING_FORK_WITHOUT_EXEC_IS_NOT_SUPPORTED_BY_FILE_MANAGER\n\nThis is because the property `padding` is initialized with `NumericProperty(sp(16))`. This call to `sp` will attempt to initialize SDL. Cf. [this question on StackOverflow](http://stackoverflow.com/questions/8106002/using-the-python-multiprocessing-module-for-io-with-pygame-on-mac-os-10-7)\n\n", "before_files": [{"content": "\"\"\"\nSlider\n======\n\n.. image:: images/slider.jpg\n\nThe :class:`Slider` widget looks like a scrollbar. It supports horizontal and\nvertical orientations, min/max values and a default value.\n\nTo create a slider from -100 to 100 starting from 25::\n\n    from kivy.uix.slider import Slider\n    s = Slider(min=-100, max=100, value=25)\n\nTo create a vertical slider::\n\n    from kivy.uix.slider import Slider\n    s = Slider(orientation='vertical')\n\n\"\"\"\n__all__ = ('Slider', )\n\nfrom kivy.uix.widget import Widget\nfrom kivy.properties import (NumericProperty, AliasProperty, OptionProperty,\n                             ReferenceListProperty, BoundedNumericProperty)\nfrom kivy.metrics import sp\n\n\nclass Slider(Widget):\n    \"\"\"Class for creating a Slider widget.\n\n    Check module documentation for more details.\n    \"\"\"\n\n    value = NumericProperty(0.)\n    '''Current value used for the slider.\n\n    :attr:`value` is a :class:`~kivy.properties.NumericProperty` and defaults\n    to 0.'''\n\n    min = NumericProperty(0.)\n    '''Minimum value allowed for :attr:`value`.\n\n    :attr:`min` is a :class:`~kivy.properties.NumericProperty` and defaults to\n    0.'''\n\n    max = NumericProperty(100.)\n    '''Maximum value allowed for :attr:`value`.\n\n    :attr:`max` is a :class:`~kivy.properties.NumericProperty` and defaults to\n    100.'''\n\n    padding = NumericProperty(sp(16))\n    '''Padding of the slider. The padding is used for graphical representation\n    and interaction. It prevents the cursor from going out of the bounds of the\n    slider bounding box.\n\n    By default, padding is sp(16). The range of the slider is reduced from\n    padding \\*2 on the screen. It allows drawing the default cursor of sp(32)\n    width without having the cursor go out of the widget.\n\n    :attr:`padding` is a :class:`~kivy.properties.NumericProperty` and defaults\n    to sp(16).'''\n\n    orientation = OptionProperty('horizontal', options=(\n        'vertical', 'horizontal'))\n    '''Orientation of the slider.\n\n    :attr:`orientation` is an :class:`~kivy.properties.OptionProperty` and\n    defaults to 'horizontal'. Can take a value of 'vertical' or 'horizontal'.\n    '''\n\n    range = ReferenceListProperty(min, max)\n    '''Range of the slider in the format (minimum value, maximum value)::\n\n        >>> slider = Slider(min=10, max=80)\n        >>> slider.range\n        [10, 80]\n        >>> slider.range = (20, 100)\n        >>> slider.min\n        20\n        >>> slider.max\n        100\n\n    :attr:`range` is a :class:`~kivy.properties.ReferenceListProperty` of\n    (:attr:`min`, :attr:`max`) properties.\n    '''\n\n    step = BoundedNumericProperty(0, min=0)\n    '''Step size of the slider.\n\n    .. versionadded:: 1.4.0\n\n    Determines the size of each interval or step the slider takes between\n    min and max. If the value range can't be evenly divisible by step the\n    last step will be capped by slider.max\n\n    :attr:`step` is a :class:`~kivy.properties.NumericProperty` and defaults\n    to 1.'''\n\n    # The following two methods constrain the slider's value\n    # to range(min,max). Otherwise it may happen that self.value < self.min\n    # at init.\n\n    def on_min(self, *largs):\n        self.value = min(self.max, max(self.min, self.value))\n\n    def on_max(self, *largs):\n        self.value = min(self.max, max(self.min, self.value))\n\n    def get_norm_value(self):\n        vmin = self.min\n        d = self.max - vmin\n        if d == 0:\n            return 0\n        return (self.value - vmin) / float(d)\n\n    def set_norm_value(self, value):\n        vmin = self.min\n        vmax = self.max\n        step = self.step\n        val = min(value * (vmax - vmin) + vmin, vmax)\n        if step == 0:\n            self.value = val\n        else:\n            self.value = min(round((val - vmin) / step) * step + vmin,\n                             vmax)\n    value_normalized = AliasProperty(get_norm_value, set_norm_value,\n                                     bind=('value', 'min', 'max', 'step'))\n    '''Normalized value inside the :attr:`range` (min/max) to 0-1 range::\n\n        >>> slider = Slider(value=50, min=0, max=100)\n        >>> slider.value\n        50\n        >>> slider.value_normalized\n        0.5\n        >>> slider.value = 0\n        >>> slider.value_normalized\n        0\n        >>> slider.value = 100\n        >>> slider.value_normalized\n        1\n\n    You can also use it for setting the real value without knowing the minimum\n    and maximum::\n\n        >>> slider = Slider(min=0, max=200)\n        >>> slider.value_normalized = .5\n        >>> slider.value\n        100\n        >>> slider.value_normalized = 1.\n        >>> slider.value\n        200\n\n    :attr:`value_normalized` is an :class:`~kivy.properties.AliasProperty`.\n    '''\n\n    def get_value_pos(self):\n        padding = self.padding\n        x = self.x\n        y = self.y\n        nval = self.value_normalized\n        if self.orientation == 'horizontal':\n            return (x + padding + nval * (self.width - 2 * padding), y)\n        else:\n            return (x, y + padding + nval * (self.height - 2 * padding))\n\n    def set_value_pos(self, pos):\n        padding = self.padding\n        x = min(self.right - padding, max(pos[0], self.x + padding))\n        y = min(self.top - padding, max(pos[1], self.y + padding))\n        if self.orientation == 'horizontal':\n            if self.width == 0:\n                self.value_normalized = 0\n            else:\n                self.value_normalized = (x - self.x - padding\n                                         ) / float(self.width - 2 * padding)\n        else:\n            if self.height == 0:\n                self.value_normalized = 0\n            else:\n                self.value_normalized = (y - self.y - padding\n                                         ) / float(self.height - 2 * padding)\n    value_pos = AliasProperty(get_value_pos, set_value_pos,\n                              bind=('x', 'y', 'width', 'height', 'min',\n                                    'max', 'value_normalized', 'orientation'))\n    '''Position of the internal cursor, based on the normalized value.\n\n    :attr:`value_pos` is an :class:`~kivy.properties.AliasProperty`.\n    '''\n\n    def on_touch_down(self, touch):\n        if self.disabled or not self.collide_point(*touch.pos):\n            return\n        if touch.is_mouse_scrolling:\n            if 'down' in touch.button or 'left' in touch.button:\n                if self.step:\n                    self.value = min(self.max, self.value + self.step)\n                else:\n                    self.value = min(\n                        self.max,\n                        self.value + (self.max - self.min) / 20)\n            if 'up' in touch.button or 'right' in touch.button:\n                if self.step:\n                    self.value = max(self.min, self.value - self.step)\n                else:\n                    self.value = max(\n                        self.min,\n                        self.value - (self.max - self.min) / 20)\n        else:\n            touch.grab(self)\n            self.value_pos = touch.pos\n        return True\n\n    def on_touch_move(self, touch):\n        if touch.grab_current == self:\n            self.value_pos = touch.pos\n            return True\n\n    def on_touch_up(self, touch):\n        if touch.grab_current == self:\n            self.value_pos = touch.pos\n            return True\n\nif __name__ == '__main__':\n    from kivy.app import App\n\n    class SliderApp(App):\n        def build(self):\n            return Slider(padding=25)\n\n    SliderApp().run()\n", "path": "kivy/uix/slider.py"}], "after_files": [{"content": "\"\"\"\nSlider\n======\n\n.. image:: images/slider.jpg\n\nThe :class:`Slider` widget looks like a scrollbar. It supports horizontal and\nvertical orientations, min/max values and a default value.\n\nTo create a slider from -100 to 100 starting from 25::\n\n    from kivy.uix.slider import Slider\n    s = Slider(min=-100, max=100, value=25)\n\nTo create a vertical slider::\n\n    from kivy.uix.slider import Slider\n    s = Slider(orientation='vertical')\n\n\"\"\"\n__all__ = ('Slider', )\n\nfrom kivy.uix.widget import Widget\nfrom kivy.properties import (NumericProperty, AliasProperty, OptionProperty,\n                             ReferenceListProperty, BoundedNumericProperty)\n\n\nclass Slider(Widget):\n    \"\"\"Class for creating a Slider widget.\n\n    Check module documentation for more details.\n    \"\"\"\n\n    value = NumericProperty(0.)\n    '''Current value used for the slider.\n\n    :attr:`value` is a :class:`~kivy.properties.NumericProperty` and defaults\n    to 0.'''\n\n    min = NumericProperty(0.)\n    '''Minimum value allowed for :attr:`value`.\n\n    :attr:`min` is a :class:`~kivy.properties.NumericProperty` and defaults to\n    0.'''\n\n    max = NumericProperty(100.)\n    '''Maximum value allowed for :attr:`value`.\n\n    :attr:`max` is a :class:`~kivy.properties.NumericProperty` and defaults to\n    100.'''\n\n    padding = NumericProperty('16sp')\n    '''Padding of the slider. The padding is used for graphical representation\n    and interaction. It prevents the cursor from going out of the bounds of the\n    slider bounding box.\n\n    By default, padding is 16sp. The range of the slider is reduced from\n    padding \\*2 on the screen. It allows drawing the default cursor of 32sp\n    width without having the cursor go out of the widget.\n\n    :attr:`padding` is a :class:`~kivy.properties.NumericProperty` and defaults\n    to 16sp.'''\n\n    orientation = OptionProperty('horizontal', options=(\n        'vertical', 'horizontal'))\n    '''Orientation of the slider.\n\n    :attr:`orientation` is an :class:`~kivy.properties.OptionProperty` and\n    defaults to 'horizontal'. Can take a value of 'vertical' or 'horizontal'.\n    '''\n\n    range = ReferenceListProperty(min, max)\n    '''Range of the slider in the format (minimum value, maximum value)::\n\n        >>> slider = Slider(min=10, max=80)\n        >>> slider.range\n        [10, 80]\n        >>> slider.range = (20, 100)\n        >>> slider.min\n        20\n        >>> slider.max\n        100\n\n    :attr:`range` is a :class:`~kivy.properties.ReferenceListProperty` of\n    (:attr:`min`, :attr:`max`) properties.\n    '''\n\n    step = BoundedNumericProperty(0, min=0)\n    '''Step size of the slider.\n\n    .. versionadded:: 1.4.0\n\n    Determines the size of each interval or step the slider takes between\n    min and max. If the value range can't be evenly divisible by step the\n    last step will be capped by slider.max\n\n    :attr:`step` is a :class:`~kivy.properties.NumericProperty` and defaults\n    to 1.'''\n\n    # The following two methods constrain the slider's value\n    # to range(min,max). Otherwise it may happen that self.value < self.min\n    # at init.\n\n    def on_min(self, *largs):\n        self.value = min(self.max, max(self.min, self.value))\n\n    def on_max(self, *largs):\n        self.value = min(self.max, max(self.min, self.value))\n\n    def get_norm_value(self):\n        vmin = self.min\n        d = self.max - vmin\n        if d == 0:\n            return 0\n        return (self.value - vmin) / float(d)\n\n    def set_norm_value(self, value):\n        vmin = self.min\n        vmax = self.max\n        step = self.step\n        val = min(value * (vmax - vmin) + vmin, vmax)\n        if step == 0:\n            self.value = val\n        else:\n            self.value = min(round((val - vmin) / step) * step + vmin,\n                             vmax)\n    value_normalized = AliasProperty(get_norm_value, set_norm_value,\n                                     bind=('value', 'min', 'max', 'step'))\n    '''Normalized value inside the :attr:`range` (min/max) to 0-1 range::\n\n        >>> slider = Slider(value=50, min=0, max=100)\n        >>> slider.value\n        50\n        >>> slider.value_normalized\n        0.5\n        >>> slider.value = 0\n        >>> slider.value_normalized\n        0\n        >>> slider.value = 100\n        >>> slider.value_normalized\n        1\n\n    You can also use it for setting the real value without knowing the minimum\n    and maximum::\n\n        >>> slider = Slider(min=0, max=200)\n        >>> slider.value_normalized = .5\n        >>> slider.value\n        100\n        >>> slider.value_normalized = 1.\n        >>> slider.value\n        200\n\n    :attr:`value_normalized` is an :class:`~kivy.properties.AliasProperty`.\n    '''\n\n    def get_value_pos(self):\n        padding = self.padding\n        x = self.x\n        y = self.y\n        nval = self.value_normalized\n        if self.orientation == 'horizontal':\n            return (x + padding + nval * (self.width - 2 * padding), y)\n        else:\n            return (x, y + padding + nval * (self.height - 2 * padding))\n\n    def set_value_pos(self, pos):\n        padding = self.padding\n        x = min(self.right - padding, max(pos[0], self.x + padding))\n        y = min(self.top - padding, max(pos[1], self.y + padding))\n        if self.orientation == 'horizontal':\n            if self.width == 0:\n                self.value_normalized = 0\n            else:\n                self.value_normalized = (x - self.x - padding\n                                         ) / float(self.width - 2 * padding)\n        else:\n            if self.height == 0:\n                self.value_normalized = 0\n            else:\n                self.value_normalized = (y - self.y - padding\n                                         ) / float(self.height - 2 * padding)\n    value_pos = AliasProperty(get_value_pos, set_value_pos,\n                              bind=('x', 'y', 'width', 'height', 'min',\n                                    'max', 'value_normalized', 'orientation'))\n    '''Position of the internal cursor, based on the normalized value.\n\n    :attr:`value_pos` is an :class:`~kivy.properties.AliasProperty`.\n    '''\n\n    def on_touch_down(self, touch):\n        if self.disabled or not self.collide_point(*touch.pos):\n            return\n        if touch.is_mouse_scrolling:\n            if 'down' in touch.button or 'left' in touch.button:\n                if self.step:\n                    self.value = min(self.max, self.value + self.step)\n                else:\n                    self.value = min(\n                        self.max,\n                        self.value + (self.max - self.min) / 20)\n            if 'up' in touch.button or 'right' in touch.button:\n                if self.step:\n                    self.value = max(self.min, self.value - self.step)\n                else:\n                    self.value = max(\n                        self.min,\n                        self.value - (self.max - self.min) / 20)\n        else:\n            touch.grab(self)\n            self.value_pos = touch.pos\n        return True\n\n    def on_touch_move(self, touch):\n        if touch.grab_current == self:\n            self.value_pos = touch.pos\n            return True\n\n    def on_touch_up(self, touch):\n        if touch.grab_current == self:\n            self.value_pos = touch.pos\n            return True\n\nif __name__ == '__main__':\n    from kivy.app import App\n\n    class SliderApp(App):\n        def build(self):\n            return Slider(padding=25)\n\n    SliderApp().run()\n", "path": "kivy/uix/slider.py"}]}