Hi, there,
I'm new to floatcanvas and wonder if I'm on the right way,
here are my codes which are very similar to the simple line 
drawer in the floatcanvas2 demo.

class LinesDrawer(object):
  def __init__(self, canvas):

       self.lines = None 
       self.canvas = canvas

       canvas.subscribe(self.onLinesBegin, 'input.left_down')
       canvas.subscribe(self.onLinesDrag,  'input.move')
       canvas.subscribe(self.onLinesEnd,   'input.left_up')
 
  def onLinesBegin(self, evt):
        startPnt = evt.coords.world
        self.lines=  self.canvas.createLines( [startPnt, startPnt], look = 
('red','white'))

  def onLinesDrag(self, evt):
        if self.lines is None:
            return

        endPnt = evt.coords.world
        
self.lines.model._setPoints(numpy.vstack([self.lines.model._getPoints(),endPnt]))
        self.lines.model._setDirty(True)

  def onLinesEnd(self, evt):
        self.lines = None

Thanks
Miles


      
_______________________________________________
FloatCanvas mailing list
[email protected]
http://paulmcnett.com/cgi-bin/mailman/listinfo/floatcanvas

Reply via email to