本文整理汇总了Python中canvas.Canvas.render方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.render方法的具体用法?Python Canvas.render怎么用?Python Canvas.render使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类canvas.Canvas
的用法示例。
在下文中一共展示了Canvas.render方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Python代码示例。
示例1: Shelf
# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import render [as 别名]
class Shelf(Pathetic):
def __init__(self, parent, name,
height=0):
Pathetic.__init__(self, parent, name)
self.height = height
self.canvas = Canvas(height)
self.fields = {}
self.boxes = []
def add_box(self, *args, **kw):
for k, v in {'line': 0, 'column': 0, 'width': 0, 'height': 0,
'align': -1, 'vfill': 0, 'raw': 0, 'wrap': 0}.items():
kw.setdefault(k, v)
kw['parent'] = self
box = Box(*args, **kw)
self.boxes.append(box)
self.canvas(box)
return box
def add_fields(self, *maybefields):
for i in maybefields:
if isinstance(i, Field):
self.fields[i.name] = i
def render(self, **kw):
self.canvas.height = self.height
self(**kw)
return self.canvas.render()
def __call__(self, **kw):
for k, v in kw.items():
try:
self.fields[k].value = v
except KeyError, msg:
raise UnknownFieldError, msg
示例2: Application
# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import render [as 别名]
class Application(object):
def __init__(self, animation, canvas, camera, extern, output):
self.animation = Animation(self, **animation)
self.canvas = Canvas(self, **canvas)
self.camera = Camera(self, **camera)
self.extern = Extern(self, **extern)
self.output = Output(self, **output)
@property
def rootPath(self):
return os.path.dirname(self.canvas.primarySource)
def run(self):
for frame, time in self.animation:
print "Frame %4i, %4.2fs" % (frame, time)
image = self.canvas.render(frame)
self.output.store(frame, image)