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


Python Canvas.__init__方法代码示例

本文整理汇总了Python中canvas.Canvas.__init__方法的典型用法代码示例。如果您正苦于以下问题:Python Canvas.__init__方法的具体用法?Python Canvas.__init__怎么用?Python Canvas.__init__使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在canvas.Canvas的用法示例。


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

示例1: __init__

# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import __init__ [as 别名]
 def __init__(self,parent,dpi=100.0):
     Canvas.__init__(self,parent,dpi)
     self.has_data = False
     self.sqplot = None
     self.cb = None
     self.colormap = customcolormap.make_colormap("mymap", 1.0, 0.001, 10)
     self.cmaplimits = 2.0
开发者ID:cstein,项目名称:fmo-ie-analyzer,代码行数:9,代码来源:fiecanvas.py

示例2: __init__

# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import __init__ [as 别名]
 def __init__(self, varname, player_1='human', player_2='random', id=None, width=300, height=300):
     valid_players = ('human', 'random', 'alphabeta')
     if player_1 not in valid_players or player_2 not in valid_players:
         raise TypeError("Players must be one of {}".format(valid_players))
     Canvas.__init__(self, varname, id, width, height)
     self.ttt = TicTacToe()
     self.state = self.ttt.initial
     self.turn = 0
     self.strokeWidth(5)
     self.players = (player_1, player_2)
     self.draw_board()
     self.font("Ariel 30px")
开发者ID:hooperw,项目名称:aima-python,代码行数:14,代码来源:games.py

示例3: __init__

# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import __init__ [as 别名]
 def __init__(self, parent):
     Canvas.__init__(self, parent)
     self.pen_cadre_1 = Pen((0,0,250), 2)
     self.pen_cadre_2 = Pen(width=3)
     self.pen_aiguille_1 = Pen(width=6)
     self.pen_aiguille_2 = Pen(width=5)
     self.pen_aiguille_3 = Pen(width=2, color=(255,0,0))
     
     self.bind(size=self.on_size)
     #self._draw_cadre()
     self.aiguille_draw_op = CombineDrawOperation(self, [])
     self.scheduler = Thread(target=self.schedule)
     self.scheduler.start()
开发者ID:typerlc,项目名称:ankice-deps,代码行数:15,代码来源:clock.py

示例4: __init__

# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import __init__ [as 别名]
    def __init__(self, renderer, max_update_delay = 0.2, *args, **keys):
        ''' Inits this canvas.
            Things setupped: background color, default camera, node factory,
            model/view/primitve renderer registries, adapter registry and
            render/update policies.
        '''
        
        if 'name' not in keys:
            keys['name'] = 'unnamed canvas'

        self.renderer = renderer

        if 'backgroundColor' in keys:
            self.backgroundColor = keys['backgroundColor']
            del keys['backgroundColor']
        else:
            self.backgroundColor = None
        
        if 'renderPolicy' in keys:
            self.renderPolicy = keys['renderPolicy']
            del keys['renderPolicy']
        else:
            #self.renderPolicy = DefaultRenderPolicy()
            self.renderPolicy = CullingRenderPolicy()

        Canvas.__init__(self, self.renderer, False, None, None, None, None, observables.ObservableLinearTransform2D(), *args, **keys)
               
        self.camera = observables.ObservableCamera( observables.ObservableLinearTransform2D(), name = 'default camera' )
        self.addChild( self.camera )
        
        self.model_kinds = [ 'Rectangle', 'RoundedRectangle', 'Circle', 'Ellipse', 'Arc', 'Text', 'Line', 'LineLength', 'Lines', 'LinesList', 'LineSegments', 'LineSegmentsSeparate', 'Bitmap', 'CubicSpline', 'QuadraticSpline', 'Polygon', 'PolygonList', 'Arrow', 'AngleArrow' ]
        self.primitive_kinds = [ 'Rectangle', 'RoundedRectangle', 'Ellipse', 'Arc', 'Text', 'LinesList', 'LineSegmentsSeparate', 'Bitmap', 'CubicSpline', 'QuadraticSpline', 'PolygonList', 'Arrow' ]

        self._setupRegistries()
        self._setupNodeFactory()
        self._setupAdapters()

        if 'updatePolicy' in keys:
            self.updatePolicy = keys['updatePolicy']
            del keys['updatePolicy']
        else:
            self.updatePolicy = DefaultUpdatePolicy( self, max_update_delay )

        self.controllers = []
        
        self.subscribe( self.onDirty, 'attribChanged' )
开发者ID:acarl123,项目名称:wxPython,代码行数:48,代码来源:simpleCanvas.py

示例5: __init__

# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import __init__ [as 别名]
 def __init__(self,parent,dpi=100.0):
   Canvas.__init__(self,parent,dpi)
   self.pos = None
   self.vel = None
开发者ID:marcosscholl,项目名称:PythonProjectsAndCodes,代码行数:6,代码来源:particlecanvas.py

示例6: __init__

# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import __init__ [as 别名]
 def __init__(self, handle):
     Canvas.__init__(self,0,0,handle)
开发者ID:mwerezak,项目名称:ascii,代码行数:4,代码来源:console.py

示例7: __init__

# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import __init__ [as 别名]
 def __init__(self, sink, enable_cairo_queue = True):
     Canvas.__init__(self, sink)
     self.size = None
     self.enable_cairo_queue = enable_cairo_queue
     self.reset_canvas()
开发者ID:msarch,项目名称:py,代码行数:7,代码来源:cairo_canvas.py

示例8: __init__

# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import __init__ [as 别名]
 def __init__(self, sink):
     Canvas.__init__(self, sink)
     self.size = None
开发者ID:arvindmeena01,项目名称:shoebot,代码行数:5,代码来源:cairo_canvas.py


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