當前位置: 首頁>>代碼示例>>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;未經允許,請勿轉載。