当前位置: 首页>>代码示例>>Python>>正文


Python Carousel.load_previous方法代码示例

本文整理汇总了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()
开发者ID:venam,项目名称:Politically-Correct,代码行数:47,代码来源:main.py

示例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
开发者ID:zeffii,项目名称:shazbat,代码行数:47,代码来源:carousel_kb.py


注:本文中的kivy.uix.carousel.Carousel.load_previous方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。