This commit is contained in:
yumoqing 2021-09-22 09:07:33 +08:00
parent 2831aa6175
commit 763b121834

View File

@ -1,4 +1,4 @@
from kivy.properties import NumericProperty, StringProperty from kivy.properties import NumericProperty, StringProperty, ListProperty
from kivy.uix.scrollview import ScrollView from kivy.uix.scrollview import ScrollView
from kivy.effects.scroll import ScrollEffect from kivy.effects.scroll import ScrollEffect
from kivy.uix.widget import Widget from kivy.uix.widget import Widget
@ -10,8 +10,8 @@ from kivyblocks.utils import *
class ScrollPanel(ScrollView): class ScrollPanel(ScrollView):
x_padding_c = NumericProperty(0) x_padding_c = NumericProperty(0)
y_padding_c = NumericProperty(0) y_padding_c = NumericProperty(0)
bg_color = ListProperty(0.2, 0.2, 0.2, 1) bgcolor = ListProperty([0.2, 0.2, 0.2, 1])
orient = StringProperty('H') orient = StringProperty('V')
def __init__(self,inner=None, **kw): def __init__(self,inner=None, **kw):
super(ScrollPanel,self).__init__() super(ScrollPanel,self).__init__()
@ -19,7 +19,7 @@ class ScrollPanel(ScrollView):
if not inner: if not inner:
kw.update({ kw.update({
'size_hint':(None,None), 'size_hint':(None,None),
'bg_color':self.bg_color, 'bgcolor':self.bgcolor,
'orientation':'vertical' 'orientation':'vertical'
}) })
desc = { desc = {
@ -37,7 +37,7 @@ class ScrollPanel(ScrollView):
self._inner.orientation = 'horizontal' self._inner.orientation = 'horizontal'
else: else:
self._inner.orientation = 'vertical' self._inner.orientation = 'vertical'
self.padding = self.spacing = \ self._inner.padding = self._inner.spacing = \
[CSize(self.x_padding_c), CSize(self.y_padding_c)] [CSize(self.x_padding_c), CSize(self.y_padding_c)]
self._inner.bind( self._inner.bind(