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


Python Canvas.get_char方法代碼示例

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


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

示例1: test_put_char

# 需要導入模塊: from caca.canvas import Canvas [as 別名]
# 或者: from caca.canvas.Canvas import get_char [as 別名]
 def test_put_char(self):
     """ module canvas: Canvas.put_char()
     """
     cv = Canvas(10, 1)
     self.assertEqual(1, cv.put_char(0, 0, "z"))
     self.assertEqual(1, cv.put_char(1, 0, "é"))
     self.assertEqual("z", cv.get_char(0, 0))
     self.assertEqual("é", cv.get_char(1, 0))
     self.assertRaises(CanvasError, cv.put_char, "a", 1, 2)
     self.assertRaises(CanvasError, cv.put_char, "a", 1, "b")
開發者ID:Kirkman,項目名稱:libcaca,代碼行數:12,代碼來源:canvas.py

示例2: test_printf

# 需要導入模塊: from caca.canvas import Canvas [as 別名]
# 或者: from caca.canvas.Canvas import get_char [as 別名]
 def test_printf(self):
     """ module canvas: Canvas.printf()
     """
     word1, word2 = "test", "string"
     cv = Canvas(10, 1)
     self.assertEqual(10, cv.printf(0, 0, "%s%s", word1, word2))
     liststring = []
     for i in range(0, 10):
         liststring.append(cv.get_char(i, 0))
     self.assertEqual("teststring", "".join(liststring))
     self.assertRaises(CanvasError, cv.printf, 0, 0, 111)
     self.assertRaises(CanvasError, cv.printf, 0, "z", "abc %s", "def")
開發者ID:Kirkman,項目名稱:libcaca,代碼行數:14,代碼來源:canvas.py

示例3: test_put_str

# 需要導入模塊: from caca.canvas import Canvas [as 別名]
# 或者: from caca.canvas.Canvas import get_char [as 別名]
    def test_put_str(self):
        """ module canvas: Canvas.put_str()
        """
        cv = Canvas(10, 1)
        self.assertEqual(10, cv.put_str(0, 0, "teststring"))
        liststring = []
        for i in range(0, 10):
            liststring.append(cv.get_char(i, 0))

        self.assertEqual("teststring", "".join(liststring))
        self.assertRaises(CanvasError, cv.put_str, 0, 0, 111)
        self.assertRaises(CanvasError, cv.put_str, 0, "z", "abc")
開發者ID:Kirkman,項目名稱:libcaca,代碼行數:14,代碼來源:canvas.py

示例4: test_get_char

# 需要導入模塊: from caca.canvas import Canvas [as 別名]
# 或者: from caca.canvas.Canvas import get_char [as 別名]
 def test_get_char(self):
     """ module canvas: Canvas.get_char()
     """
     cv = Canvas(1, 1)
     self.assertEqual(" ", cv.get_char(0, 0))
開發者ID:Kirkman,項目名稱:libcaca,代碼行數:7,代碼來源:canvas.py


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