MASSIVE EDIT:
Download the latest version from GitHub, as the load_next
issue has been resolved there. Running the following code results into the proper intended behavior.
from kivy.app import App
from kivy.uix.gridlayout import GridLayout
from kivy.uix.label import Label
from kivy.uix.carousel import Carousel
from kivy.uix.image import Image
from kivy.factory import Factory
from kivy.clock import Clock
class Logo(App):
def build(self):
main_layout = GridLayout(cols=1, rows=2)
top_row = GridLayout(cols=3, rows=1)
bottom_row = GridLayout(cols=1)
logo = Image(source='bird.jpg')
title = Label(text='Just three birds.',font_size='40sp')
ip = Label(text='tweet\ntweet\ntweet',font_size='20sp')
carousel = Carousel(direction='right', loop=True, size_hint=(.5,.5),pos=(0,180))
for i in range(1,4):
src = "bird%s.jpg" % str(i)
image = Factory.AsyncImage(source=src, allow_stretch=True)
carousel.add_widget(image)
Clock.schedule_interval(carousel.load_next, 1.0)
top_row.add_widget(logo)
top_row.add_widget(title)
top_row.add_widget(ip)
bottom_row.add_widget(carousel)
main_layout.add_widget(top_row)
main_layout.add_widget(bottom_row)
return main_layout
if __name__ == '__main__':
Logo().run()
Make sure you change the image files to the ones you are using as well as the labels/text. It should work now.
See the demo video here.