本文整理汇总了Python中kivy.uix.carousel.Carousel.clear_widgets方法的典型用法代码示例。如果您正苦于以下问题:Python Carousel.clear_widgets方法的具体用法?Python Carousel.clear_widgets怎么用?Python Carousel.clear_widgets使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类kivy.uix.carousel.Carousel
的用法示例。
在下文中一共展示了Carousel.clear_widgets方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: ViewSpellScreen
# 需要导入模块: from kivy.uix.carousel import Carousel [as 别名]
# 或者: from kivy.uix.carousel.Carousel import clear_widgets [as 别名]
class ViewSpellScreen(MyScreen):
def __init__(self, **kwargs):
super(ViewSpellScreen, self).__init__(**kwargs)
self.carousel = Carousel()
self.content_box.add_widget(self.carousel)
self.bind(on_pre_enter= self.prepare_yourself)
def prepare_yourself(self,i=0):
self.carousel.clear_widgets()
for spell in App.get_running_app().root.current_list:
self.carousel.add_widget(spell['view_spell_card'])
position = App.get_running_app().root.current_position
self.carousel.index = position
示例2: gfsViewerApp
# 需要导入模块: from kivy.uix.carousel import Carousel [as 别名]
# 或者: from kivy.uix.carousel.Carousel import clear_widgets [as 别名]
#.........这里部分代码省略.........
if (len(largs) > 0 and self.last_df != 0):
if self.last_df == largs[0]:
ignore = True
else:
ignore = False
self.last_df = largs[0]
else:
ignore = False
# for some reason to many events where fired, so ignore
# calls that don't have a unique timestamp
if not ignore:
if self.active_region == "M-Europa":
self.steps = 3
self.limit = 60
else:
self.steps = 6
self.limit = 30
if self.active_region in ["M-Europa","Europa"]:
self.src = "http://m.ash.to/gfsViewer/imgloader.php?file=R%s%02d%d.gif&type=.png"
else:
self.src = "http://www.wetterzentrale.de/pics/R%s%02d%d.png"
self.loadnum = 0
self.image = []
self.last_df = 0
self._load_next(*largs)
def _clear_loader(self, *largs):
Loader.stop()
self.carousel.clear_widgets()
self.loadnum = 0
self.image = []
self.pb.value = 0
self.ltext.text = "total: "
# now load
Clock.schedule_once(self._load_values,0.2)
# new value selected callback
def _on_value_select(self,x):
self.carousel.clear_widgets()
Clock.schedule_once(self._clear_loader)
setattr(self.value_button, 'text', x)
self.active_value = x
# region select callback
def _on_region_select(self,x):
setattr(self.region_button, 'text', x)
self.active_region = x
self._on_value_select(self.active_value)
# build layout and app
def build(self):
self.icon = 'data/icon-s.png'
self.layout = BoxLayout(orientation='vertical')
ab = ActionBar(size_hint=(1,0.08), height="48dp")
av = ActionView()
av.add_widget(ActionPrevious(title=appTitle,with_previous=False, app_icon=self.icon))
ab.add_widget(av)
self.layout.add_widget(ab)
#region_dropdown = DropDown()
# disable drop-down options for the moment.
# needs more work (also different value selectors)
#for i in regions:
# btn = Button(text=i, size_hint_y=None, height="48dp")
# btn.bind(on_release=lambda btn: region_dropdown.select(btn.text))
# region_dropdown.add_widget(btn)
# region_dropdown.bind(on_select=lambda instance, x: self._on_region_select(x))
self.region_button = Button(text=self.active_region, size_hint_y=None, height="48dp")
#self.region_button.bind(on_release=region_dropdown.open)
self.layout.add_widget(self.region_button)
value_dropdown = DropDown()
for i in range(len(values)):
btn = Button(text=values[i], size_hint_y=None, height="48dp")
btn.bind(on_release=lambda btn: value_dropdown.select(btn.text))
value_dropdown.add_widget(btn)
value_dropdown.bind(on_select=lambda instance, x: self._on_value_select(x))
self.value_button = Button(text=self.active_value, size_hint_y=None, height="48dp")
self.value_button.bind(on_release=value_dropdown.open)
self.layout.add_widget(self.value_button)
self.layout.add_widget(self.carousel)
self.pb = ProgressBar(max=100,value=50, size_hint=(1,0.08),height=48)
self.layout.add_widget(self.pb)
self.ltext = Label(text='', size_hint_y=None,height="12dp",font_size="10dp")
self.layout.add_widget(self.ltext)
self._on_value_select(self.active_value)
return self.layout