This commit is contained in:
yumoqing 2021-12-04 23:41:12 +08:00
parent b21aef7f6d
commit 6621d9583f
2 changed files with 4 additions and 7 deletions

View File

@ -51,6 +51,7 @@ class ToggleText(ClickableText):
"on_css":"selected", "on_css":"selected",
"off_css":"normal" "off_css":"normal"
}) })
"""
select_state = BooleanProperty(False) select_state = BooleanProperty(False)
on_css = StringProperty('default') on_css = StringProperty('default')
@ -59,7 +60,7 @@ class ToggleText(ClickableText):
super(ToggleText, self).__init__(**kw) super(ToggleText, self).__init__(**kw)
def on_press(self, o=None): def on_press(self, o=None):
if self.select_state = if self.select_state?False else True self.select_state = False if self.select_state else True
def on_select_state(self, o, f): def on_select_state(self, o, f):
if f: if f:
@ -90,7 +91,7 @@ class ToggleImage(ClickableImage):
super(ToggleImage, self).__init__(**kw) super(ToggleImage, self).__init__(**kw)
def on_press(self, o): def on_press(self, o):
self.select_state = if self.select_state ? False, True self.select_state = False if self.select_state else True
def on_select_state(self, o, f): def on_select_state(self, o, f):
if self.img_w: if self.img_w:
@ -104,7 +105,3 @@ class ToggleImage(ClickableImage):
else: else:
self.img_w = AsyncImage(source=self.source) self.img_w = AsyncImage(source=self.source)
class Select(VBox):
"""
"""

View File

@ -30,7 +30,7 @@ class TypeWriterBox(WidgetCSS, WidgetReady, Widget):
def add_veritcal_box(self): def add_veritcal_box(self):
box = BoxLayout(orientation='vertical', size_hint_y=None) box = BoxLayout(orientation='vertical', size_hint_y=None)
box.bind(minimum_height = box.setter('height') box.bind(minimum_height = box.setter('height'))
super(TypeWriterBox, self).add_widget(box) super(TypeWriterBox, self).add_widget(box)
return box return box