本文整理汇总了Python中canvas.Canvas.print_tool方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.print_tool方法的具体用法?Python Canvas.print_tool怎么用?Python Canvas.print_tool使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类canvas.Canvas
的用法示例。
在下文中一共展示了Canvas.print_tool方法的1个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Dappy
# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import print_tool [as 别名]
class Dappy():
canvas = None
filename = None
path = None
FileHandler = None
def __init__(self, path, image_filename=None):
# Initialize canvas
self.canvas = Canvas()
self.FileHandler = FileIO()
# Load image information
if image_filename != None:
info = self.FileHandler.read(os.path.abspath(image_filename))
self.set_current_info(info)
else:
self.filename = None
self.path = path
self.canvas.clear_overlay()
self.canvas.print_tool()
def set_current_info(self, image_info):
if image_info == None:
return
canonical_filename = image_info[0]
self.canvas.set_image(image_info[1])
self.fix_image_info(canonical_filename)
def fix_image_info(self, canonical_filename):
if canonical_filename == None:
return
self.filename = os.path.basename(canonical_filename)
self.path = os.path.dirname(canonical_filename)