本文整理匯總了Python中kivy.uix.carousel.Carousel.load_previous方法的典型用法代碼示例。如果您正苦於以下問題:Python Carousel.load_previous方法的具體用法?Python Carousel.load_previous怎麽用?Python Carousel.load_previous使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類kivy.uix.carousel.Carousel
的用法示例。
在下文中一共展示了Carousel.load_previous方法的2個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: MainScreen
# 需要導入模塊: from kivy.uix.carousel import Carousel [as 別名]
# 或者: from kivy.uix.carousel.Carousel import load_previous [as 別名]
class MainScreen(BoxLayout):
def __init__(self, **kwargs):
super(MainScreen, self).__init__(**kwargs)
self.orientation = 'vertical'
title = TitleBar()
self.carousel = Carousel(direction='right', loop=False)
self.spacing=10
dico = Dictionary()
self.carousel.add_widget(dico)
self.m = MainMenu()
self.m.convert_button.bind(on_release=self.convert)
self.m.dictionary_button.bind(on_release=self.dictionary)
self.carousel.add_widget(self.m)
self.carousel.load_slide(self.m)
self.textEntry = TextEntry()
self.textEntry.paragraph_button.bind(on_press=self.convert_paragraph)
self.carousel.add_widget(self.textEntry)
self.result = ResultEntry()
self.result.back.bind(on_press=self.back)
self.carousel.add_widget(self.result)
self.add_widget(title)
self.add_widget(self.carousel)
def convert(self, object):
self.carousel.load_next()
def dictionary(self, object):
self.carousel.load_previous()
def back(self, object):
self.carousel.load_slide(self.m)
def convert_paragraph(self, object):
old_text = self.textEntry.paragraph.text
new_text = politically_correct.polit_changer(old_text)
self.result.paragraph.text = new_text
self.carousel.load_next()
示例2: Example1
# 需要導入模塊: from kivy.uix.carousel import Carousel [as 別名]
# 或者: from kivy.uix.carousel.Carousel import load_previous [as 別名]
class Example1(App):
def build(self):
self.additional_init()
self.carousel = Carousel(
direction='right',
loop=True)
for src in k.filenames:
image = Factory.AsyncImage(source=src, allow_stretch=True)
self.carousel.add_widget(image)
return self.carousel
def additional_init(self):
self._keyboard = Window.request_keyboard(self._keyboard_closed, self, 'text')
self._keyboard.bind(on_key_down=self._on_keyboard_down)
def _keyboard_closed(self):
print('My keyboard have been closed!')
self._keyboard.unbind(on_key_down=self._on_keyboard_down)
self._keyboard = None
def _print_debug(self, keycode, text, modifiers):
print('The key', keycode, 'have been pressed')
print(' - text is %r' % text)
print(' - modifiers are %r' % modifiers)
def _on_keyboard_down(self, keyboard, keycode, text, modifiers):
self._print_debug(keycode, text, modifiers)
# If we hit escape, release the keyboard
k = keycode[1]
if k == 'escape':
keyboard.release()
if k == 'right':
self.carousel.load_next()
pass
if k == 'left':
self.carousel.load_previous()
pass
return True