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


Python Util.centerString方法代码示例

本文整理汇总了Python中util.Util.centerString方法的典型用法代码示例。如果您正苦于以下问题:Python Util.centerString方法的具体用法?Python Util.centerString怎么用?Python Util.centerString使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在util.Util的用法示例。


在下文中一共展示了Util.centerString方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。

示例1: printScreen

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import centerString [as 别名]
    def printScreen(self):
        scn = self.__screen
        scn.clear()
        scn.border(0)

        # Title
        scn.addstr(0, 35, "PIZZA CLUB", curses.A_STANDOUT)

        # construct inner Window
        begin_x = 1 ; begin_y = 1
        height = 22 ; width = 78
        win = curses.newwin(height, width, begin_y, begin_x)

        # Menu
        menu_text = "press q to exit"
        win.addstr(height - 1, width - len(menu_text) - 1, menu_text)
        
        # Brewskeeball
        win.addstr(3, 0, Util.centerString("Next Matchup", width))
        win.addstr(5, 0, Util.centerString(self.__brewskeeball.matchupTeams(), width))
        win.addstr(7, 0, Util.centerString("%s at %s" % (self.__brewskeeball.matchupDate(), self.__brewskeeball.matchupTime()), width))
        
        # Render screen
        scn.refresh()
        win.refresh()
开发者ID:trg,项目名称:raspberrystatus,代码行数:27,代码来源:pizzaclub.py

示例2: printScreen

# 需要导入模块: from util import Util [as 别名]
# 或者: from util.Util import centerString [as 别名]
    def printScreen(self):
        scn = self.__screen
        scn.clear()
        scn.border(0)

        # Title
        scn.addstr(0, 31, "RASPBERRY STATUS", curses.A_STANDOUT)

        # construct inner Window
        begin_x = 1 ; begin_y = 1
        height = 22 ; width = 78
        win = curses.newwin(height, width, begin_y, begin_x)

        # Weather
        win.clear()
        win.addstr(0, 0, "Weather For Today - Data provided by NOAA", curses.A_BOLD)
        weather_text = self.wordwrapStringAt(self.__weather.description() , width)
        win.addstr(1, 0, weather_text)
        win.hline( 3, 0, "-", width)

        # Brewskeeball
        win.addstr(4, 0, "Brewskeeball", curses.A_BOLD)
        win.addstr(5, 4, "Next Matchup:")
        win.addstr(6, 0, Util.centerString(self.__brewskeeball.matchupTeams(), width))
        win.addstr(7, 0, Util.centerString("%s at %s" % (self.__brewskeeball.matchupDate(), self.__brewskeeball.matchupTime()), width))
        win.hline( 8, 0, "-", width)

        # Twitter
        win.addstr(9,  0, Util.centerString("TWITTER @tom_g_", width), curses.A_BOLD)
        latest_tweet = self.__twitter.latestTweet()
        author_name = "@%s" % latest_tweet.author.screen_name
        win.addstr(10, 0, author_name, curses.A_BOLD)
        win.addstr(10, len(author_name)+1, latest_tweet.text )
        
        # Render screen
        scn.refresh()
        win.refresh()
开发者ID:trg,项目名称:raspberrystatus,代码行数:39,代码来源:raspberrystatus.py


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