當前位置: 首頁>>代碼示例>>Python>>正文


Python Navigation.currentItem方法代碼示例

本文整理匯總了Python中navigation.Navigation.currentItem方法的典型用法代碼示例。如果您正苦於以下問題:Python Navigation.currentItem方法的具體用法?Python Navigation.currentItem怎麽用?Python Navigation.currentItem使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在navigation.Navigation的用法示例。


在下文中一共展示了Navigation.currentItem方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。

示例1: Interface

# 需要導入模塊: from navigation import Navigation [as 別名]
# 或者: from navigation.Navigation import currentItem [as 別名]
class Interface(object):
    def __init__(self):
        self._lcd_plate = LcdPlate()

        self._navigation = Navigation()

        self.initScreen()

    def initScreen(self):
        self._lcd_plate.clear()

        self._lcd_plate.setBackLightCyan()

        # Set the screen to the top of the menu
        self._lcd_plate.message(self._navigation.currentItem())

    def pressedDown(self):
        self._navigation.moveDown()

    def pressedLeft(self):
        self._navigation.moveLeft()

    def pressedRight(self):
        self._navigation.moveRight()

    def pressedSelect(self):
        # TODO: Actually run the process that the navigation items expects
        self._lcd_plate.clear()
        self._lcd_plate.message("In Select")

    def pressedUp(self):
        self._navigation.moveUp()

    def run(self):
        while True:
            for button in self._lcd_plate.buttons():
                # Check if a button is pressed & there has been pause in pressing the buttons
                if self._lcd_plate.pressedSinceLastCheck(button):
                    # Call function of the button pressed
                    getattr(self, 'pressed' + self._lcd_plate.titleOfButton(button))()

                    self.initScreen()
開發者ID:sjacres,項目名稱:iot-chicken-coop,代碼行數:44,代碼來源:interface.py


注:本文中的navigation.Navigation.currentItem方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。