本文整理汇总了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
示例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")
示例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()
示例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' )
示例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
示例6: __init__
# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import __init__ [as 别名]
def __init__(self, handle):
Canvas.__init__(self,0,0,handle)
示例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()
示例8: __init__
# 需要导入模块: from canvas import Canvas [as 别名]
# 或者: from canvas.Canvas import __init__ [as 别名]
def __init__(self, sink):
Canvas.__init__(self, sink)
self.size = None