本文整理汇总了Python中kivy.uix.carousel.Carousel类的典型用法代码示例。如果您正苦于以下问题:Python Carousel类的具体用法?Python Carousel怎么用?Python Carousel使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。
在下文中一共展示了Carousel类的15个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: build
def build(self):
carousel = Carousel(direction='right')
for i in range(10):
src = "http://placehold.it/480x270.png&text=slide-%d&.png" % i
image = AsyncImage(source=src, allow_stretch=True)
carousel.add_widget(image)
return carousel
示例2: __init__
def __init__(self, **kwargs):
super(screenLayout, self).__init__(**kwargs)
#buttons
larrow = Button(background_normal='arrows/scroll-left.png',
background_down='arrows/scroll-left-hit.png',
size_hint = (0.06,0.1),
pos_hint={'x':0, 'y':.5},
)
rarrow = Button(background_normal='arrows/scroll-right.png',
background_down='arrows/scroll-right-hit.png',
size_hint = (0.06,0.1),
pos_hint={'x':0.93, 'y':.5}
)
#carousel gallery
root = Carousel(loop='true')
for i in range(1,5):
src = "images/%d.png" % i
images = Image(source=src,
pos_hint = {'x':0.15,'y':0.25},
size_hint= (0.7,0.7),
allow_stretch=True)
root.add_widget(images)
self.add_widget(root)
self.add_widget(larrow)
self.add_widget(rarrow)
示例3: __init__
def __init__(self, **kwargs):
Screen.__init__(self, **kwargs)
main = BoxLayout(orientation="vertical")
main.add_widget(ActionBar(size_hint=(1, .125)))
carousel = Carousel(direction='right')
layout = GridLayout(rows=2)
i, c = 0, 0
for card in self.definition.cards(App.get_running_app().achievements,
use_blocks=False):
color = (1, 1, 1, 1)
if str(card) in self.definition.blocked_cards:
color = (.5, 0, 0, 1)
layout.add_widget(CardSelect(card=card,
color=color,
callback=self._card_detail,
args=(card,)))
i += 1
c += 1
if i == 10:
carousel.add_widget(layout)
layout = GridLayout(rows=2)
i = 0
if c < 50 + len(self.definition.specials):
layout.add_widget(CardSelect(card=self.LOCKED_CARD))
carousel.add_widget(layout)
main.add_widget(carousel)
self.add_widget(main)
示例4: DeckCatalogScreen
class DeckCatalogScreen(Screen):
"""Provide a means of exploring and purchasing available decks."""
catalog = ObjectProperty()
def __init__(self, **kwargs):
Screen.__init__(self, **kwargs)
self.carousel = Carousel(direction="right")
standard = self.catalog["Lovers & Spies Deck"]
self.carousel.add_widget(DeckDisplay(deck=standard, purchased=True))
for deck in self.catalog:
if deck == standard: continue
purchased = self.catalog.purchased(deck) is not None
self.carousel.add_widget(DeckDisplay(deck=deck, purchased=purchased))
main = BoxLayout(orientation="vertical")
main.add_widget(ActionBar())
main.add_widget(self.carousel)
self.add_widget(main)
def update(self):
for slide in self.carousel.slides:
if slide.deck.base_filename == "Standard":
continue
slide.purchased = self.catalog.purchased(slide.deck) is not None
示例5: CarouCntrl
class CarouCntrl(Widget):
# root
def __init__(self):
super(CarouCntrl, self).__init__()
# init screens
self.home_screen = HomeScreen(name='home')
self.settings_screen = SettingsScreen(name='settings')
# self.draw_screen = DrawScreen(name='draw')
# init carousel
self.carousel = Carousel(direction='right', loop=True)
# add widgets to carousel
# for i in range(3):
# self.carousel.add_widget(self.home_screen)
self.carousel.add_widget(self.home_screen)
self.carousel.add_widget(self.settings_screen)
# self.carousel.add_widget(self.draw_screen)
# start getting data from OWM
self.owm_link = OWMLink(self)
self.owm_thread = threading.Thread(target=self.owm_link.run, args=())
self.owm_thread.start()
def shutdown(self):
self.owm_link.keep_running = False
示例6: build
def build(self):
carousel = Carousel(direction="right", loop="true")
for i in range(1, 5):
src = "images/%d.jpg" % i
image = Image(source=src, pos=(400, 100), size=(400, 400))
carousel.add_widget(image)
return carousel
示例7: __init__
def __init__(self):
# Create carousel - doesn't work so well in .kv
Carousel.__init__(self,direction='right',loop='true',scroll_distance=80,scroll_timeout=100)
self.overview = Overview()
self.add_widget(self.overview)
self.add_widget(Label(text='Hello World2'))
self.game = PongGame()
self.game.serve_ball()
self.add_widget(self.game)
示例8: build
def build(self):
#define the carousel
carousel = Carousel(direction='right',loop='true')
filenames = [filename for filename in os.listdir('.') if filename.endswith('.jpg') or filename.endswith('.jpeg')]
for imagefile in filenames:
#load pictures from images folder
imgsize = PILImage.open(imagefile).size
image = Image(source=imagefile,pos=(0,0), size=imgsize)
carousel.add_widget(image)
return carousel
示例9: __init__
def __init__(self, **kwargs):
kwargs['orientation'] = 'vertical'
super(GraphView, self).__init__(**kwargs)
self.graph_list = [CostPlot(),
VolumePlot(),
DistancePlot(),
EfficiencyPlot()]
graph_carousel = Carousel(direction='right')
for i in range(len(self.graph_list)):
graph_carousel.add_widget(self.graph_list[i].graph)
self.add_widget(graph_carousel)
示例10: build
def build(self):
root = self.root
# get any files into images directory
curdir = dirname(__file__)
carousel = Carousel(direction='right', loop='True')
#replace file_name with the directory where your pictures are located
for filename in glob(join(curdir, 'file_name', '*')):
image = Factory.AsyncImage(source=filename, allow_stretch=True)
carousel.add_widget(image)
return carousel
示例11: build
def build(self):
carousel = Carousel(direction="right")
for i in range(10):
layout = BoxLayout(orientation="vertical")
image1 = AsyncImage(source=("http://placehold.it/480x270.png&text=slide-%d&.png" % i), allow_stretch=True)
image2 = AsyncImage(
source=("http://placehold.it/480x270.png&text=slide-%d&.png" % (i + 1)), allow_stretch=True
)
layout.add_widget(image1)
layout.add_widget(Label(text="Image %d" % i, font_size=30))
layout.add_widget(image2)
layout.add_widget(Label(text="Second Image %d" % (i + 1), font_size=30))
carousel.add_widget(layout)
return carousel
示例12: btn_stats_state
def btn_stats_state(self, instance, value):
print "btn2", instance, value
if value == 'down':
gg = self.ayevent.get_all_stats_graph()
carousel = Carousel(direction='right', loop=True)
for g in gg:
print g
image = Factory.AsyncImage(source=g, allow_stretch=True)
carousel.add_widget(image)
self._stats_removed = self.mainw.children[0]
self.mainw.remove_widget(self._stats_removed)
self.mainw.add_widget(carousel, 0)
elif value == 'normal':
self.mainw.remove_widget(self.mainw.children[0])
self.mainw.add_widget(self._stats_removed)
示例13: __init__
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)
示例14: build
def build(self):
global katy
katy=self.config.get('ustawienia', 'miarakatowa')
root = Carousel(direction = 'right', loop=False, anim_move_duration=0.4)
#self.settings_cls = SettingsWithSidebar
kar = ObjectProperty()
kar= MenuRoot()
kar1=Biegun()
kar2=AzymutDlugosc()
kar3=PolePowierzchni()
kar4=WciecieLiniowe()
karTab=[kar,kar1,kar2,kar3,kar4]
for x in range(5):
klas=karTab[x]
root.add_widget(klas)
return root_widget
示例15: Carousel
def Carousel(self, buton):
self.layout.clear_widgets()
self.carousel = Carousel(direction = 'right')
self.carousel.anim_move_duration = 1
self.carousel.loop = True
self.carousel.size_hint = (0.7, 0.7)
self.carousel.pos = (200, 120)
self.layout.add_widget(self.carousel)
self.image1 = Image(source = 'E:/PROGRAMMIN/Curs/Pentru examen/fisiere proiect/nature1.jpg')
self.carousel.add_widget(self.image1)
self.image2 = Image(source= 'E:/PROGRAMMIN/Curs/Pentru examen/fisiere proiect/nature2.jpg')
self.carousel.add_widget(self.image2)
self.image3 = Image(source = 'E:/PROGRAMMIN/Curs/Pentru examen/fisiere proiect/nature3.jpg')
self.carousel.add_widget(self.image3)
self.image4 = Image(source = 'E:/PROGRAMMIN/Curs/Pentru examen/fisiere proiect/nature4.jpg')
self.carousel.add_widget(self.image4)
self.label = Label(text = 'This is the end of the list!', font_size = 30)
self.carousel.add_widget(self.label)
self.backbutton = Button(text = 'Back', bold = True, background_color = (0, 0, 1, 1))
self.backbutton.pos = (200, 100)
self.backbutton.size_hint = (0.7, 0.1)
self.layout.add_widget(self.backbutton)
self.backbutton.bind(on_press = self.Menu)