当前位置: 首页>>代码示例>>Python>>正文


Python Canvas.render方法代码示例

本文整理汇总了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
开发者ID:BackupTheBerlios,项目名称:luca-erp-svn,代码行数:37,代码来源:pathetic.py

示例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)
开发者ID:redyeti,项目名称:camela-2.5D,代码行数:19,代码来源:application.py


注:本文中的canvas.Canvas.render方法示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。