• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Python graphics.CanvasContext类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

本文整理汇总了Python中nodebox.graphics.CanvasContext的典型用法代码示例。如果您正苦于以下问题:Python CanvasContext类的具体用法?Python CanvasContext怎么用?Python CanvasContext使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。



在下文中一共展示了CanvasContext类的20个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于我们的系统推荐出更棒的Python代码示例。

示例1: size

 def size(self, width, height):
     CanvasContext.size(self, width, height)
     # To keep the WIDTH and HEIGHT properties up to date in the executing script,
     # the Context object must have access to its namespace. Normally, we passed this
     # during construction time.
     self._ns["WIDTH"] = width
     self._ns["HEIGHT"] = height
开发者ID:Banbury,项目名称:nodebox,代码行数:7,代码来源:__init__.py


示例2: font

 def font(self, fontname=None, fontsize=None):
     if fontname is not None and fontsize is not None:
         return CanvasContext.font(self, fontname, fontsize)
     elif fontname is not None:
         return CanvasContext.font(self, fontname)
     elif fontsize is not None:
         CanvasContext.fontsize(self, fontsize)
     return CanvasContext.font(self)
开发者ID:Banbury,项目名称:nodebox,代码行数:8,代码来源:__init__.py


示例3: rect

 def rect(self, x, y, width, height, roundness=0.0, draw=True, **kwargs):
     if roundness == 0:
         p = CanvasContext.rect(self, x, y, width, height, Boolean(draw))
     else:
         rw = roundness * width * 0.5
         rh = roundness * height * 0.5
         p = CanvasContext.rect(self, x, y, width, height, rw, rh, Boolean(draw))
     self._setAttributesFromKwargs(p, **kwargs)
     return p
开发者ID:Banbury,项目名称:nodebox,代码行数:9,代码来源:__init__.py


示例4: __init__

 def __init__(self, canvas=None, ns=None):
     args = canvas is not None and [canvas] or []
     CanvasContext.__init__(self, *args)
     if ns is None:
         ns = {}
     self._ns = ns
     
     # todo: better way to handle mouse events
     self._ns["MOUSEX"] = 0
     self._ns["MOUSEY"] = 0
     self._ns["mousedown"] = False
开发者ID:Banbury,项目名称:nodebox,代码行数:11,代码来源:__init__.py


示例5: text

 def text(self, txt, x, y, width=0, height=0, outline=False, draw=True, **kwargs):
     if outline:
         t = CanvasContext.text(self, unicode(txt), x, y, width, height, Boolean(False))
         p = t.path
         self._setAttributesFromKwargs(p, **kwargs)
         if draw:
             self.addPath(p)
         return p
     else:
         t = CanvasContext.text(self, unicode(txt), x, y, width, height, Boolean(draw))
         self._setAttributesFromKwargs(t, **kwargs)
         return t
开发者ID:Banbury,项目名称:nodebox,代码行数:12,代码来源:__init__.py


示例6: imagesize

 def imagesize(self, path, data=None):
     if data is not None:
         from nodebox.graphics import Image
         arg = Image.fromData(data).awtImage
     else:
         arg = path
     return CanvasContext.imagesize(self, arg)
开发者ID:Banbury,项目名称:nodebox,代码行数:7,代码来源:__init__.py


示例7: image

 def image(self, path, x, y, width=None, height=None, alpha=1.0, data=None, draw=True, **kwargs):
     if data is not None:
         from nodebox.graphics import Image
         arg = Image.fromData(data).awtImage
     else:
         arg = path
     img = CanvasContext.image(self, arg, x, y, width, height, alpha, Boolean(draw))
     # todo: handle data and kwargs
     return img
开发者ID:Banbury,项目名称:nodebox,代码行数:9,代码来源:__init__.py


示例8: arrow

 def arrow(self,
           x,
           y,
           width=100,
           type=CanvasContext.NORMAL,
           draw=True,
           **kwargs):
     p = CanvasContext.arrow(self, x, y, width, type, Boolean(draw))
     self._setAttributesFromKwargs(p, **kwargs)
     return p
开发者ID:alessandrostone,项目名称:nodebox,代码行数:10,代码来源:__init__.py


示例9: findpath

    def findpath(self, points, curvature=1.0):
        # The list of points consists of Point objects,
        # but it shouldn't crash on something straightforward
        # as someone supplying a list of (x,y)-tuples.

        from types import TupleType
        for i, pt in enumerate(points):
            if type(pt) == TupleType:
                points[i] = Point(pt[0], pt[1])
        return CanvasContext.findpath(self, points, curvature)
开发者ID:Banbury,项目名称:nodebox,代码行数:10,代码来源:__init__.py


示例10: star

 def star(self,
          startx,
          starty,
          points=20,
          outer=100,
          inner=50,
          draw=True,
          **kwargs):
     p = CanvasContext.star(self, startx, starty, points, outer, inner,
                            Boolean(draw))
     self._setAttributesFromKwargs(p, **kwargs)
     return p
开发者ID:alessandrostone,项目名称:nodebox,代码行数:12,代码来源:__init__.py


示例11: beginpath

 def beginpath(self, x=None, y=None):
     if x != None and y != None:
         CanvasContext.beginpath(self, x, y)
     else:
         CanvasContext.beginpath(self)
开发者ID:Banbury,项目名称:nodebox,代码行数:5,代码来源:__init__.py


示例12: color

 def color(self, *args):
     if len(args) == 1 and isinstance(args[0], tuple):
         args = args[0]
     return CanvasContext.color(self, *args)
开发者ID:Banbury,项目名称:nodebox,代码行数:4,代码来源:__init__.py


示例13: line

 def line(self, x1, y1, x2, y2, draw=True, **kwargs):
     p = CanvasContext.line(self, x1, y1, x2, y2, Boolean(draw))
     self._setAttributesFromKwargs(p, **kwargs)
     return p
开发者ID:Banbury,项目名称:nodebox,代码行数:4,代码来源:__init__.py


示例14: stroke

 def stroke(self, *args):
     if len(args) == 1 and isinstance(args[0], tuple):
         args = args[0]
     return CanvasContext.stroke(self, *args)
开发者ID:Banbury,项目名称:nodebox,代码行数:4,代码来源:__init__.py


示例15: ellipse

 def ellipse(self, x, y, width, height, draw=True, **kwargs):
     p = CanvasContext.ellipse(self, x, y, width, height, Boolean(draw))
     self._setAttributesFromKwargs(p, **kwargs)
     return p
开发者ID:Banbury,项目名称:nodebox,代码行数:4,代码来源:__init__.py


示例16: autoclosepath

 def autoclosepath(self, close=None):
     if close is None:
         return CanvasContext.autoclosepath(self)
     else:
         return CanvasContext.autoclosepath(self, Boolean(close))
开发者ID:Banbury,项目名称:nodebox,代码行数:5,代码来源:__init__.py


示例17: lineheight

 def lineheight(self, lineheight=None):
     if lineheight is not None:
         return CanvasContext.lineheight(self, lineheight)
     return CanvasContext.lineheight(self)
开发者ID:Banbury,项目名称:nodebox,代码行数:4,代码来源:__init__.py


示例18: colorrange

 def colorrange(self, range=None):
     if range is not None:
         return CanvasContext.colorrange(self, range)
     return CanvasContext.colorrange(self)
开发者ID:Banbury,项目名称:nodebox,代码行数:4,代码来源:__init__.py


示例19: colormode

 def colormode(self, mode=None, range=None):
     if mode is None:
         if range is not None:
             CanvasContext.colorrange(self, range)
         return CanvasContext.colormode(self)
     return CanvasContext.colormode(self, mode, range)
开发者ID:Banbury,项目名称:nodebox,代码行数:6,代码来源:__init__.py


示例20: fontsize

 def fontsize(self, fontsize=None):
     if fontsize is not None:
         return CanvasContext.fontsize(self, fontsize)
     return CanvasContext.fontsize(self)
开发者ID:Banbury,项目名称:nodebox,代码行数:4,代码来源:__init__.py



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Python graphics.Geometry类代码示例发布时间:2022-05-27
下一篇:
Python factory.create_vote函数代码示例发布时间:2022-05-27
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap