Пример #1
0
    def __init__(self, width=600, height=300):
        VerticalPanel.__init__(self)
        self.elements = []
        self.desc = []

        self.canvas = Raphael(width, height)
        self.canvas.addListener('mouseup', self.onCanvasMouseup)
        self.canvas.addListener('mousemove', self.onCanvasMousemove)
        self.canvas.addListener('dblclick', self.onCanvasDblClick)
        self.canvas.addListener('contextmenu', self.onCanvasContextmenu)
        self.canvas.addListener('mousedown', self.onCanvasMousedown)

        self.add(self.canvas)
        self.status = Label('Execute any events on the canvas!')
        self.add(self.status)
Пример #2
0
    def __init__(self,width=600,height=300):
        """ Standard initialiser.
        """
        SimplePanel.__init__(self)

        # Taken from the "spinner" Raphael demo:
        self.width            = 15
        self.r1               = 35
        self.r2               = 60
        self.cx               = self.r2 + self.width
        self.cy               = self.r2 + self.width
        self.numSectors  = 12
        self.canvas      = Raphael(self.r2*2 + self.width*2, self.r2*2 + self.width*2)
        self.sectors     = []
        self.opacity     = []
        self.add(self.canvas)
Пример #3
0
    def __init__(self):
        """ Standard initialiser.
        """
        SimplePanel.__init__(self)

        # Taken from the "spinner" Raphael demo:

        colour = "#000000"
        width = 15
        r1 = 35
        r2 = 60
        cx = r2 + width
        cy = r2 + width
        self.numSectors = 12
        self.canvas = Raphael(r2 * 2 + width * 2, r2 * 2 + width * 2)
        self.sectors = []
        self.opacity = []
        beta = 2 * math.pi / self.numSectors

        pathParams = {
            'stroke': colour,
            'stroke-width': width,
            'stroke-linecap': "round"
        }

        for i in range(self.numSectors):
            alpha = beta * i - math.pi / 2
            cos = math.cos(alpha)
            sin = math.sin(alpha)
            path = self.canvas.path(data=None, attrs=pathParams)
            path.moveTo(cx + r1 * cos, cy + r1 * sin)
            path.lineTo(cx + r2 * cos, cy + r2 * sin)
            self.opacity.append(1 / self.numSectors * i)
            self.sectors.append(path)

        period = 1000 / self.numSectors

        self._timer = Timer(notify=self)
        self._timer.scheduleRepeating(period)

        self.add(self.canvas)
Пример #4
0
 def __init__(self, width=600, height=300):
     SimplePanel.__init__(self)
     self.canvas = Raphael(width, height)
     self.add(self.canvas)