本文整理匯總了Python中caca.canvas.Canvas.rotate_180方法的典型用法代碼示例。如果您正苦於以下問題:Python Canvas.rotate_180方法的具體用法?Python Canvas.rotate_180怎麽用?Python Canvas.rotate_180使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類caca.canvas.Canvas
的用法示例。
在下文中一共展示了Canvas.rotate_180方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: main
# 需要導入模塊: from caca.canvas import Canvas [as 別名]
# 或者: from caca.canvas.Canvas import rotate_180 [as 別名]
def main():
""" Main function. """
try:
pig = Canvas(0, 0)
pig.import_from_memory(STRING, "text")
cv = Canvas(pig.get_width() * 2, pig.get_height() * 2)
except CanvasError as err:
sys.stderr.write("%s\n" % err)
sys.exit(2)
cv.blit(0, 0, pig, NullCanvas())
pig.flip()
cv.blit(pig.get_width(), 0, pig, NullCanvas())
pig.flip()
pig.flop()
cv.blit(0, pig.get_height(), pig, NullCanvas())
pig.flop()
pig.rotate_180()
cv.blit(pig.get_width(), pig.get_height(), pig, NullCanvas())
for j in range(0, cv.get_height()):
for i in range(0, cv.get_width(), 2):
cv.set_color_ansi(caca.COLOR_LIGHTBLUE + (i + j) % 6,
caca.COLOR_DEFAULT)
a = cv.get_attr(-1, -1)
cv.put_attr(i, j, a)
cv.put_attr(i+1, j, a)
print("%s" % cv.export_to_memory('utf8'))
cv.rotate_left()
print("%s" % cv.export_to_memory('utf8'))