Exemplo n.º 1
0
    def __init__(self, canvas, elements=[], **properties):

        if not all(isinstance(e, (Element, ElementFactory)) for e in elements):
            raise TypeError('A group can only contain canvas elements')
        self._elements = [e if isinstance(e, Element) else e.construct(canvas) \
         for e in elements]
        Element.__init__(self, canvas, **properties)
Exemplo n.º 2
0
    def __init__(self,
                 canvas,
                 x=0,
                 y=0,
                 orient=0,
                 freq=.05,
                 env=u'gaussian',
                 size=96,
                 stdev=12,
                 phase=0,
                 col1=u'white',
                 col2=u'black',
                 bgmode=u'avg'):

        Element.__init__(self,
                         canvas,
                         x=x,
                         y=y,
                         orient=orient,
                         freq=freq,
                         env=env,
                         size=size,
                         stdev=stdev,
                         phase=phase,
                         col1=col1,
                         col2=col2,
                         bgmode=bgmode)
Exemplo n.º 3
0
    def __init__(self,
                 canvas,
                 fname,
                 center=True,
                 x=None,
                 y=None,
                 scale=None,
                 rotation=None):

        x, y = canvas.none_to_center(x, y)
        Element.__init__(self,
                         canvas,
                         fname=fname,
                         center=center,
                         x=x,
                         y=y,
                         scale=scale,
                         rotation=rotation)
Exemplo n.º 4
0
    def __init__(self,
                 canvas,
                 text,
                 center=True,
                 x=None,
                 y=None,
                 max_width=None,
                 **properties):

        global pyqt_initialized

        if not pyqt_initialized:
            self._init_pyqt(canvas.experiment)
            pyqt_initialized = True
        x, y = canvas.none_to_center(x, y)
        properties = properties.copy()
        properties.update({
            'text': safe_decode(text),
            'center': center,
            'x': x,
            'y': y,
            'max_width': max_width
        })
        Element.__init__(self, canvas, **properties)
Exemplo n.º 5
0
    def __init__(self, canvas, x, y, w, h, **properties):

        properties = properties.copy()
        x, y, w, h = self._rect(x, y, w, h)
        properties.update({'x': x, 'y': y, 'w': w, 'h': h})
        Element.__init__(self, canvas, **properties)
Exemplo n.º 6
0
    def __init__(self, canvas, sx, sy, ex, ey, **properties):

        properties = properties.copy()
        properties.update({'sx': sx, 'sy': sy, 'ex': ex, 'ey': ey})
        Element.__init__(self, canvas, **properties)
Exemplo n.º 7
0
    def __init__(self, canvas, text, x, y, **properties):

        properties = properties.copy()
        properties.update({'text': text, 'x': x, 'y': y})
        Element.__init__(self, canvas, **properties)
Exemplo n.º 8
0
	def __init__(self, canvas, x=0, y=0, env=u"gaussian", size=96, stdev=12,
		col1=u"white", col2=u"black", bgmode=u"avg"):

		Element.__init__(self, canvas, x=x, y=y, env=env, size=size,
			stdev=stdev, col1=col1, col2=col2, bgmode=bgmode)
Exemplo n.º 9
0
    def _setter(key, self, val):

        if key == u'visible':
            return Element._setter(key, self, val)
        raise TypeError(u'Properties of element groups cannot be changed')
Exemplo n.º 10
0
    def __init__(self, canvas, vertices, **properties):

        properties = properties.copy()
        properties.update({'vertices': vertices})
        Element.__init__(self, canvas, **properties)