本文整理汇总了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