U
    Pe#                     @   s.  d Z dZddlmZ ddlmZ ddlmZ ddlm	Z	 ddl
mZ ddlmZ dd	lmZ dd
lmZ ddlmZ ddlmZmZmZmZmZmZmZmZ ddlmZ d ZZ e	re	!ddZd"e	!ddZ G dd deZ#e$dkr*ddl%m&Z& ddl'm(Z( ddl)m*Z* G dd de&Z+e+ ,  dS )a  
ScrollView
==========

.. versionadded:: 1.0.4

The :class:`ScrollView` widget provides a scrollable/pannable viewport that is
clipped at the scrollview's bounding box.


Scrolling Behavior
------------------

The ScrollView accepts only one child and applies a viewport/window to
it according to the :attr:`~ScrollView.scroll_x` and
:attr:`~ScrollView.scroll_y` properties. Touches are analyzed to
determine if the user wants to scroll or control the child in some
other manner: you cannot do both at the same time. To determine if
interaction is a scrolling gesture, these properties are used:

    - :attr:`~ScrollView.scroll_distance`: the minimum distance to travel,
      defaults to 20 pixels.
    - :attr:`~ScrollView.scroll_timeout`: the maximum time period, defaults
      to 55 milliseconds.

If a touch travels :attr:`~ScrollView.scroll_distance` pixels within the
:attr:`~ScrollView.scroll_timeout` period, it is recognized as a scrolling
gesture and translation (scroll/pan) will begin. If the timeout occurs, the
touch down event is dispatched to the child instead (no translation).

The default value for those settings can be changed in the configuration file::

    [widgets]
    scroll_timeout = 250
    scroll_distance = 20

.. versionadded:: 1.1.1

    ScrollView now animates scrolling in Y when a mousewheel is used.


Limiting to the X or Y Axis
---------------------------

By default, the ScrollView allows scrolling along both the X and Y axes. You
can explicitly disable scrolling on an axis by setting the
:attr:`~ScrollView.do_scroll_x` or :attr:`~ScrollView.do_scroll_y` properties
to False.


Managing the Content Size and Position
--------------------------------------

The ScrollView manages the position of its children similarly to a
:class:`~kivy.uix.relativelayout.RelativeLayout` but does not use the
:attr:`~kivy.uix.widget.Widget.size_hint`. You must
carefully specify the :attr:`~kivy.uix.widget.Widget.size` of your content to
get the desired scroll/pan effect.

By default, the :attr:`~kivy.uix.widget.Widget.size_hint` is (1, 1), so the
content size will fit your ScrollView
exactly (you will have nothing to scroll). You must deactivate at least one of
the size_hint instructions (x or y) of the child to enable scrolling.
Setting :attr:`~kivy.uix.widget.Widget.size_hint_min` to not be None will
also enable scrolling for that dimension when the :class:`ScrollView` is
smaller than the minimum size.

To scroll a :class:`~kivy.uix.gridlayout.GridLayout` on it's Y-axis/vertically,
set the child's width  to that of the ScrollView (size_hint_x=1), and set
the size_hint_y property to None::

    from kivy.uix.gridlayout import GridLayout
    from kivy.uix.button import Button
    from kivy.uix.scrollview import ScrollView
    from kivy.core.window import Window
    from kivy.app import runTouchApp

    layout = GridLayout(cols=1, spacing=10, size_hint_y=None)
    # Make sure the height is such that there is something to scroll.
    layout.bind(minimum_height=layout.setter('height'))
    for i in range(100):
        btn = Button(text=str(i), size_hint_y=None, height=40)
        layout.add_widget(btn)
    root = ScrollView(size_hint=(1, None), size=(Window.width, Window.height))
    root.add_widget(layout)

    runTouchApp(root)


Kv Example::

    ScrollView:
        do_scroll_x: False
        do_scroll_y: True

        Label:
            size_hint_y: None
            height: self.texture_size[1]
            text_size: self.width, None
            padding: 10, 10
            text:
                'really some amazing text\n' * 100

Overscroll Effects
------------------

.. versionadded:: 1.7.0

When scrolling would exceed the bounds of the :class:`ScrollView`, it
uses a :class:`~kivy.effects.scroll.ScrollEffect` to handle the
overscroll. These effects can perform actions like bouncing back,
changing opacity, or simply preventing scrolling beyond the normal
boundaries. Note that complex effects may perform many computations,
which can be slow on weaker hardware.

You can change what effect is being used by setting
:attr:`~ScrollView.effect_cls` to any effect class. Current options
include:

    - :class:`~kivy.effects.scroll.ScrollEffect`: Does not allow
      scrolling beyond the :class:`ScrollView` boundaries.
    - :class:`~kivy.effects.dampedscroll.DampedScrollEffect`: The
      current default. Allows the user to scroll beyond the normal
      boundaries, but has the content spring back once the
      touch/click is released.
    - :class:`~kivy.effects.opacityscroll.OpacityScrollEffect`: Similar
      to the :class:`~kivy.effect.dampedscroll.DampedScrollEffect`, but
      also reduces opacity during overscroll.

You can also create your own scroll effect by subclassing one of these,
then pass it as the :attr:`~ScrollView.effect_cls` in the same way.

Alternatively, you can set :attr:`~ScrollView.effect_x` and/or
:attr:`~ScrollView.effect_y` to an *instance* of the effect you want to
use. This will override the default effect set in
:attr:`~ScrollView.effect_cls`.

All the effects are located in the :mod:`kivy.effects`.

)
ScrollView    )partial)	Animation)string_types)Config)Clock)Factory)StencilView)dp)DampedScrollEffect)NumericPropertyBooleanPropertyAliasPropertyObjectPropertyListPropertyReferenceListPropertyOptionPropertyColorProperty)FocusBehaviorZwidgetsscroll_timeoutz{}spscroll_distancec                       s  e Zd ZdZeeZedZeeZ	edZ
edZedZedZdd Zdd	 Zeeed
ddZedZdd ZeedddZdd ZeedddZeddddgZeddddgZedZedddZedddZeeeZ edZ!e"e#ddZ$e"dddZ%e"dddZ&e'ddgZ(edgdgdgddgddgfdZ)edddZ*e"dddZ+e'ddddgZ,dZ-dZ.dZ/dZ0d d! Z1d"d# Z2d$Z3 fd%d&Z4d'd( Z5d)d* Z6d+d, Z7d-d. Z8d/d0 Z9d1d2 Z:d3d4 Z;d5d6 Z<d7d8 Z=d9d: Z>d;d< Z?dg fd=d>	Z@ fd?d@ZA fdAdBZBdCdD ZCdEdF ZDdhdGdHZE fdIdJZFdKdL ZG fdMdNZHdidOdPZIdjdRdSZJdTdU ZKdVdW ZLdXdY ZMdZd[ ZN fd\d]ZO fd^d_ZPdkdadbZQdcdd ZR fdedfZS  ZTS )lr   a  ScrollView class. See module documentation for more information.

    :Events:
        `on_scroll_start`
            Generic event fired when scrolling starts from touch.
        `on_scroll_move`
            Generic event fired when scrolling move from touch.
        `on_scroll_stop`
            Generic event fired when scrolling stops from touch.

    .. versionchanged:: 1.9.0
        `on_scroll_start`, `on_scroll_move` and `on_scroll_stop` events are
        now dispatched when scrolling to handle nested ScrollViews.

    .. versionchanged:: 1.7.0
        `auto_scroll`, `scroll_friction`, `scroll_moves`, `scroll_stoptime' has
        been deprecated, use :attr:`effect_cls` instead.
    Z20sp              ?Tc                 C   s   | j | jfS Ndo_scroll_xdo_scroll_y)self r   7/tmp/pip-unpacked-wheel-xzebddm3/kivy/uix/scrollview.py_get_do_scroll  s    zScrollView._get_do_scrollc                 C   s0   t |ttfr|\| _| _nt| | _| _d S r   )
isinstancelisttupler   r   bool)r   valuer   r   r   _set_do_scroll	  s    zScrollView._set_do_scrollr   )bindcachec                 C   sh   | j d krdS | j j}| j}||k s,|dkr0dS td|t| }tdtd| j}d| | }||fS N)r   r   r   g{Gz?r   r   )	_viewportheightmaxfloatminscroll_y)r   Zvhhphsypyr   r   r   	_get_vbar)  s    
zScrollView._get_vbar)r/   r*   viewport_sizer+   c                 C   sh   | j d krdS | j j}| j}||k s,|dkr0dS td|t| }tdtd| j}d| | }||fS r)   )r*   widthr,   r-   r.   scroll_x)r   ZvwwpwsxZpxr   r   r   	_get_hbarF  s    
zScrollView._get_hbar)r7   r*   r5   r6   gffffff?g?皙?2dpbottom)topr>   )optionsright)leftrA   r   )Z	allownoneNcontentbarsc                 C   s
   || _ d S r   )r5   r   instancer%   r   r   r   _set_viewport_size  s    zScrollView._set_viewport_sizec                 C   s   |r|j | jd |j| _d S )N)size)r'   rG   rH   r5   rE   r   r   r   on__viewport  s    zScrollView.on__viewport)on_scroll_starton_scroll_moveon_scroll_stopc              	      s  d | _ t| jd| _ddlm}m}m}m	} | | _
| | _| j
j |  |dd| _W 5 Q R X | j
j |  W 5 Q R X tt| jf | | d | d | d | j| j
 | j}t|trt|}| jd kr|d k	r|| jd| _| jd kr|d k	r|| jd| _| j}| j}| j}	| j}
| j}|d|	 |d	|
 |d
| j  |d| |d| |d| |d| |d| |  |  |	  |
  d S )Nr   )
PushMatrix	Translate	PopMatrixCanvasrJ   rK   rL   target_widgetr6   r+   r5   r*   r7   r/   posrH   )!_touchr   create_triggerupdate_from_scroll_trigger_update_from_scrollZkivy.graphicsrN   rO   rP   rQ   canvas_viewportcanvasbeforeg_translateaftersuperr   __init__Zregister_event_typeadd
effect_clsr!   r   r   geteffect_xr*   effect_y_update_effect_widget_update_effect_x_bounds_update_effect_y_boundsfbind_update_effect_bounds)r   kwargsrN   rO   rP   rQ   ra   Ztrigger_update_from_scrollZupdate_effect_widgetZupdate_effect_x_boundsZupdate_effect_y_boundsrh   	__class__r   r   r_     sT     













zScrollView.__init__c                 C   s   |r|j | jd | j|_d S Nscroll)r'   _update_effect_xr*   rS   rE   r   r   r   on_effect_x?  s    zScrollView.on_effect_xc                 C   s   |r|j | jd | j|_d S rm   )r'   _update_effect_yr*   rS   rE   r   r   r   on_effect_yD  s    zScrollView.on_effect_yc                 C   sT   t |trt|}|| jd| _| jj| jd || jd| _| jj| j	d d S )NrR   rn   )
r!   r   r   rb   r*   rc   r'   rp   rd   rr   )r   rF   clsr   r   r   on_effect_clsI  s    

zScrollView.on_effect_clsc                 G   s$   | j r| j| j _| jr | j| j_d S r   )rc   r*   rS   rd   r   argsr   r   r   re   Q  s    
z ScrollView._update_effect_widgetc                 G   sH   | j r| jsd S | j| jd  }d| j_td|| j_|| j | j_d S )Nr   )r*   rc   r6   r5   r.   r,   r7   r%   )r   rw   Zscrollable_widthr   r   r   rf   W  s    z"ScrollView._update_effect_x_boundsc                 G   sR   | j r| jsd S | j| jd  }|dk r,dn|| j_|| j_| jj| j | j_d S N   r   )r*   rd   r+   r5   r.   r,   r/   r%   )r   rw   Zscrollable_heightr   r   r   rg   _  s    z"ScrollView._update_effect_y_boundsc                 G   s   |    |   d S r   )rf   rg   rv   r   r   r   ri   g  s    z ScrollView._update_effect_boundsc                 G   sv   | j }|r| jsd S | jjr*|j| j }n|j| j }|dk rN| jrJ| jsNd S |dkrj| jj| }| | _| 	  d S rx   )
r*   rc   	is_manualr6   _effect_x_start_widthalways_overscrollr   ro   r7   rX   )r   rw   vpswr:   r   r   r   rp   k  s    
zScrollView._update_effect_xc                 G   sv   | j }|r| jsd S | jjr*|j| j }n|j| j }|dk rN| jrJ| jsNd S |dkrj| jj| }| | _| 	  d S rx   )
r*   rd   rz   r+   _effect_y_start_heightr|   r   ro   r/   rX   )r   rw   r}   shr2   r   r   r   rr   {  s    
zScrollView._update_effect_yc                 K   s   | j j\}}|| || fS r   r\   xyr   xyktxtyr   r   r   to_local  s    zScrollView.to_localc                 K   s   | j j\}}|| || fS r   r   r   r   r   r   	to_parent  s    zScrollView.to_parentc                    s,   | j j\}}|||d tt| |dS )Nr   r   r   )r\   r   	translater^   r   _apply_transform)r   mrT   r   r   rk   r   r   r     s    zScrollView._apply_transformc                    s0   |   || j tt| |}|  |S r   )pushapply_transform_2dr   r^   r   on_touch_downpop)r   touchretrk   r   r   simulate_touch_down  s
    zScrollView.simulate_touch_downc                    sR   |j | jkrDd|jkrD|  || j t ||}|  |S t ||S )NrT   )	Ztype_idZmotion_filterprofiler   r   r   r^   	on_motionr   )r   etypemer   rk   r   r   r     s    zScrollView.on_motionc                 C   s$   |  d|r || _||  dS d S )NrJ   T)dispatchrU   Zgrab)r   r   r   r   r   r     s    
zScrollView.on_touch_downc                 C   sL   |\}}|\}}||j   ko(|| kn  oJ||j  koF|| kS   S r   r   r   )r   rT   rH   r   r   r   r6   r+   r   r   r   _touch_in_handle  s    zScrollView._touch_in_handlec                 C   s  |r8|   || j | d|r0|  dS |  | j|j sXd|j| d< d S | j	rbdS | j
st| js~| js~| |S | j}|sdS | j}|j}d|k}| jr| jp|j| jk}| jr| jp|j| jk}|j| j | j | j|j | j |j| j | j | j|j | j d}	|oB|oBd|	| j   ko>| jkn  |d< |ot|otd|	| j   kop| jkn  |d< d	|jkrJ|jd
rJ|j}
| j}d }|
dkr| jdks|
dkr| jdks|
dkr| j dks|
dkr | j dkr dS | j!r8| jr8|r8|
dkr8|d r0| j!n| j"}n6| j"rn| jrn|rn|
dkrn|d rh| j"n| j!}|rF| #  |
dkr| j$r| j%|| j$ 8  _%n0| jr|j&| |_&nt'|j&| |j'|_&d|_%nX|
dkr.| j$r| j%|| j$ 7  _%n0| jr|j&| |_&nt(|j&| |j(|_&d|_%d|j| d< |)  dS |d pZ|d }|dgkrx|sx| |S |r|d r| *| j+| j,|s|j| j | j | _n2|d r| *| j-| j.|s|j| j | j | _ || _
|  }ddd|t/j0|j1d||< | jrV| j!rV|d sV|d sV| #  | j| _2| j!3|j | j | _4| jr| j"r|d s|d s| #  | j| _5| j"3|j | j| _6|st/7| j8| j9d  dS )NrJ   TsvavoidrD   )r>   r?   rB   rA   r   in_bar_xin_bar_ybuttonro   
scrolldownry   scrollup
scrollleftscrollrightF)r   r   )r   r   )r   r   )r   r   unknown)modedxdyuser_stoppedframestimeg     @@):r   r   r   dispatch_childrenr   collide_pointrT   ud_get_uiddisabledrU   r   r   r   r*   scroll_typer|   r6   r+   r   
bar_marginr?   r   rA   	bar_pos_x	bar_width	bar_pos_yr   r   
startswithscroll_wheel_distancer/   r7   rc   rd   ri   smooth_scroll_endZvelocityr%   r,   r.   Ztrigger_velocity_updater   Z_handle_y_posZ_handle_y_sizeZ_handle_x_posZ_handle_x_sizer   r   Z
time_startr{   startZ_scroll_x_mouser   Z_scroll_y_mouseschedule_once_change_touch_moder   )r   r   check_childrenr}   r   r   Z
scroll_barZwidth_scrollableZheight_scrollabledbtnr   eZin_baruidr   r   r   rJ     s   


  



  
  
	zScrollView.on_scroll_startc                    s   | j |k	rP| j|j rB|  || j tt| | |	  | 
 |jkS |j| k	r^dS tdd |jD s| j|j r|  || j tt| |}|	  |S dS ddd|jd< | d|rdS d S )NTc                 s   s"   | ]}t |to|d V  qdS )zsv.N)r!   strr   ).0keyr   r   r   	<genexpr>Y  s   z+ScrollView.on_touch_move.<locals>.<genexpr>Fr   
sv.handledrK   )rU   r   rT   r   r   r   r^   r   on_touch_mover   r   r   grab_currentanyr   )r   r   resrk   r   r   r   L  s,    

zScrollView.on_touch_movec           
      C   s*  |  d|jkrdS |  || j | d|r@|  dS |  d}d|jd< |   }||jkrzd| _| |dS |j| }|d dkr6| j	s| j
s|  || j || j |   |  d S |d  t|j7  < |d	  t|j7  < |d | jkr| j	s.|d	 | jkr6| j
r6d
|d< |d d
kr&|jdd od|jdd }|jd d s4| j	r4| jr4| j}|jddr| jd dkr|jt||| jd    }tt| j| dd| _|   n|r| j|j | jdk s| jdkrd}nd|jd d< d|jd< |jd d s| j
r| jr| j}|jddr| jd dkr|jt||| jd    }	tt| j|	 dd| _|   n|r| j|j  | jdk s| jdkrd}nd|jd d< d|jd< |j!|d  |d< |j!|d< d|d< |S )Nr   FrK   Tsv.can_defocusr   r   r   r   ro   r   r   r   r   ry   r   r   r   r   r   dtr   )"r   r   r   r   r   r   r   rU   rJ   r   r   	to_windowr   absr   r   r   rb   rc   r6   hbarr-   r.   r,   r7   rX   updater   rd   r+   vbarr/   r   Ztime_update)
r   r   rvr   r   
not_in_barr6   r   r+   r   r   r   r   rK   i  s    




 


zScrollView.on_scroll_movec                    s   |  d}| j|k	rf||jkrf| j|j rb|  || j tt	| 
|rZ|  dS |  dS | d|r||  |jddstj| dS d S )Nr   TFrL   r   )r   rU   r   r   rT   r   r   r   r^   r   on_touch_upr   r   ungrabrb   r   Zignored_touchappend)r   r   r   rk   r   r   r     s    

zScrollView.on_touch_upc                 C   s`  d | _ |r>|  || j | d|r6|  dS |  | d|jkrRd S |  |jkrddS d | _ |  }|j| }|jdd o|jdd }| j	r| j
r|r| j
|j | jr| jr|r| j|j |d dkr|d	 s| | tt| j|d
 | j}|d kr.t| j }| _|  d|jkrR|jdrRdS |  |jkS )NrL   Tr   Fr   r   r   r   r   r<   r   ro   )rU   r   r   r   r   r   r   r   rb   r   rc   stopr   r   rd   r   r   r   r   r   _do_touch_up_update_effect_bounds_evrV   ri   r   r   r   )r   r   r   r   r   r   evr   r   r   rL     sF    



zScrollView.on_scroll_stop
   c                    s  j s
dS tjdr<jjjr<t fdd dS ttt	frRfj j
jj  }j j
jj }d }}|d jk rj|d  td  }n(|d jkr؈j|d  td  }|d jk rj|d  td  }n*|d jkr.j|d  td  }||\}}	tdtdj| }
tdtdj|	 } r dkrdd	d
 tdd tf |
|d  n|
_|_dS )av  Scrolls the viewport to ensure that the given widget is visible,
        optionally with padding and animation. If animate is True (the
        default), then the default animation parameters will be used.
        Otherwise, it should be a dict containing arguments to pass to
        :class:`~kivy.animation.Animation` constructor.

        .. versionadded:: 1.9.1
        NZ	do_layoutc                     s     S r   )	scroll_to)r   animatepaddingr   widgetr   r   <lambda>      z&ScrollView.scroll_to.<locals>.<lambda>r   ry   Tr<   Zout_quad)r   tr7   r/   )r7   r/   )parenthasattrr*   Z_trigger_layoutZis_triggeredr   r   r!   intr-   	to_widgetr   rT   rA   r?   r   r
   r   convert_distance_to_scrollr.   r,   r7   r/   r   stop_allr   )r   r   r   r   rT   Zcorr   r   ZdsxZdsyZsxpZsypr   r   r   r     sB    	


zScrollView.scroll_toc                 C   sl   | j s
dS | j }|j| jkr6|j| j }|t| }nd}|j| jkr`|j| j }|t| }nd}||fS )zConvert a distance in pixels to a scroll distance, depending on the
        content size and the scrollview size.

        The result will be a tuple of scroll distance that can be added to
        :data:`scroll_x` and :data:`scroll_y`
        r   r   ry   )r*   r6   r-   r+   )r   r   r   r}   r~   r:   r   r2   r   r   r   r   /  s    z%ScrollView.convert_distance_to_scrollc           
      G   s  | j s| j| j_dS | j }|jdk	rb|j| j }|jdk	rFt||j}|jdk	r\t	||j}||_|j
dk	r|j
| j }|jdk	rt||j}|jdk	rt	||j}||_|j| jks| jr|j| j }| j| j|  }n| j}|j| jks| jr|j| j }| j| j|  }n| j|j }d|_||f| j_| j}	|	dkrTt| jd }	| _| d| j t| d | d| j | j| _|	  dS )aA  Force the reposition of the content, according to current value of
        :attr:`scroll_x` and :attr:`scroll_y`.

        This method is automatically called when one of the :attr:`scroll_x`,
        :attr:`scroll_y`, :attr:`pos` or :attr:`size` properties change, or
        if the size of the content changes.
        Nr         ?bar_inactive_color
_bar_color	bar_color)r*   rT   r\   r   Zsize_hint_xr6   Zsize_hint_min_xr,   Zsize_hint_max_xr.   Zsize_hint_yr+   Zsize_hint_min_yZsize_hint_max_yr|   r   r7   r   r/   r?   _bind_inactive_bar_color_evr   rV   _bind_inactive_bar_colorfunbind_change_bar_colorr   r   rh   r   r   )
r   largsr}   r8   r0   r~   r   r   r   r   r   r   r   rW   E  sN    







 
zScrollView.update_from_scrollc                 G   s6   |  d| j | d| j t| jddd|  d S )Nr   r   r   Z	out_quart)r   r   r   )r   r   rh   r   r   r   )r   lr   r   r   r     s     z#ScrollView._bind_inactive_bar_colorc                 C   s
   || _ d S r   )r   )r   instr%   r   r   r   r     s    zScrollView._change_bar_colorc                    s^   | j rtd| j}| j| _tt| j|f|| || _|| _ |j| j| jd |   d S )Nz!ScrollView accept only one widget)rH   Zsize_hint_min)	r*   	ExceptionrZ   rY   r^   r   
add_widgetr'   rX   r   r   rw   rj   rZ   rk   r   r   r     s    zScrollView.add_widgetc                    s@   | j }| j| _ tt| j|f|| || _ || jkr<d | _d S r   )rZ   rY   r^   r   remove_widgetr*   r   rk   r   r   r     s    
zScrollView.remove_widgetsvc                 C   s   d || jS )Nz{0}.{1})formatr   )r   prefixr   r   r   r     s    zScrollView._get_uidc                 G   s   | j s
d S |  }| j }||jkr,d| _ d S |j| }|d dksJ|d rNd S tj|d  }|dk rvt| jd d S | jr| jr| j	  | j
r| jr| j	  ||  d | _ |  || j || j | | |  d S )NFr   r   r   r      r   )rU   r   r   r   r   r   r   r   rc   cancelr   rd   r   r   r   r   r   r   r   )r   r   r   r   r   Zdiff_framesr   r   r   r     s4    





zScrollView._change_touch_modec                    s   |   || j tt| | |  |jd d  D ]N}|j| | }|sVq:||_	|   || j tt| | |  q:d |_	d S r   )
r   r   r   r^   r   r   r   Z	grab_listremover   )r   r   r   r   rk   r   r   r     s    
zScrollView._do_touch_up)N)T)T)r   T)r   )U__name__
__module____qualname____doc__r   _scroll_distancer   r   _scroll_timeoutr   r7   r/   r   r   r   r    r&   r   Z	do_scrollr|   r4   r   r;   r   r   r   r   r   r   r   r   r   Zbar_posr   r   r   ra   rc   rd   r   r5   r   r   r*   r   r{   r   r   r   rG   rI   Z
__events__r_   rq   rs   ru   re   rf   rg   ri   rp   rr   r   r   r   r   r   r   r   rJ   r   rK   r   rL   r   r   rW   r   r   r   r   r   r   r   __classcell__r   r   rk   r   r      s   	




 2	
 Q
-
3<
)r   __main__)App)
GridLayout)Buttonc                   @   s   e Zd Zdd ZdS )ScrollViewAppc                 C   s   t dddd}|j|d|dd tdD ] }tt|dd	d
}|| q0tddd}|| t dddd}|j|d|dd tdD ] }tt|dd	d
}|| qtdgddd}|| t dd}|| || |S )N   r   )NN)colsspacing	size_hintr+   r6   )Zminimum_heightZminimum_width(   )   d   )textr  rH   r=   )r   r   rD   Z9dpr  )r   r   r      )r  )r  r'   setterranger  r   r   r   )r   Zlayout1ir   Zscrollview1Zlayout2Zscrollview2rootr   r   r   build  s:    






zScrollViewApp.buildN)r   r   r   r  r   r   r   r   r	    s   r	  N)-r  __all__	functoolsr   Zkivy.animationr   Zkivy.compatr   Zkivy.configr   Z
kivy.clockr   Zkivy.factoryr   Zkivy.uix.stencilviewr	   Zkivy.metricsr
   Zkivy.effects.dampedscrollr   Zkivy.propertiesr   r   r   r   r   r   r   r   Zkivy.uix.behaviorsr   r  r  getintr   r   r   Zkivy.appr  Zkivy.uix.gridlayoutr  Zkivy.uix.buttonr  r	  runr   r   r   r   <module>   sD    (
        A
