def __init__(self, **kvargs):
super(ScrollButton, self).__init__(**kvargs)
self.layout = GridLayout(cols=1, padding=5, spacing=5,
size_hint_y=None)
self.layout.bind(minimum_height=self.layout.setter('height'))
self.body = Popup(content=self, size_hint_y=None, size_hint_x=None,
pos_hint={"center_x": .5, "center_y": .5},
width=int(Window.size[0] / self.size_hint_x),
background=self.background_image)
# ??? ??? ?????? ????????? - (canvas GridLayout).
with self.layout.canvas:
Color(0.0, 0.0, 0.0)
self.canvas_for_box_content = \
Rectangle(pos=(5, 5), size=(self.layout.width,
self.layout.height))
self.layout.bind(size=self._update_canvas_size,
pos=self._update_canvas_size)
for list_button in self.button_list:
if not list_button[2]:
image = "atlas://data/images/defaulttheme/button"
else:
image = list_button[2]
button = Button(text=list_button[0], size_hint_y=None,
height=self.height_button,
background_normal=image, id=list_button[0])
if callable(self.events_callback):
button.bind(on_press=self.events_callback,
on_release=self._close_popup)
self.layout.add_widget(button)
text = list_button[1]
if text:
self.layout.add_widget(
RstDocument(text=text, size_hint_y=None,
background_color=self.background_text_color,
underline_color="#2fbfe0",
height=self.height_text))
self.add_widget(self.layout)
评论列表
文章目录