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


Python TextTable.color方法代碼示例

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


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

示例1: test_title_with_color

# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import color [as 別名]
    def test_title_with_color(self):
        """display with title and color"""
        tbl = TextTable("%filesystem %two")
        tbl.title = "title"
        tbl.color = True
        tbl.append({'filesystem': 'foo', 'two': 'bar'})
        self.assertEqual(str(tbl), 
"====\033[34m title \033[0m===\n"
"\033[34mFILESYSTEM TWO\033[0m\n"
"---------- ---\n"
"foo        bar")
開發者ID:kcgthb,項目名稱:lustre-shine,代碼行數:13,代碼來源:TextTableTest.py

示例2: setup_table

# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import color [as 別名]
def setup_table(options, fmt=None):
    """
    Return a TextTable already setup based on display command line options like
    color and header.
    """
    tbl = TextTable(fmt)
    tbl.color = (options.color == 'auto' and Globals()['color'] == 'auto' \
                      and sys.stdout.isatty()) or \
                (options.color == 'auto' and Globals()['color'] == 'always') \
                or (options.color == 'always')

    tbl.show_header = options.header
    return tbl
開發者ID:kcgthb,項目名稱:lustre-shine,代碼行數:15,代碼來源:Display.py

示例3: test_color

# 需要導入模塊: from Shine.CLI.TextTable import TextTable [as 別名]
# 或者: from Shine.CLI.TextTable.TextTable import color [as 別名]
 def test_color(self):
     """display with color"""
     tbl = TextTable("%one")
     tbl.color = True
     tbl.append({'one': 'foo'})
     self.assertEqual(str(tbl), "\033[34mONE\033[0m\n---\nfoo")
開發者ID:kcgthb,項目名稱:lustre-shine,代碼行數:8,代碼來源:TextTableTest.py


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