wxLineShape::MakeLineControlPoints

To insert a line in my canvas I'm doing the following:

def AddLine(self, sh1, sh2, x, y):
        ''' Add a line to connect two objects: sh1, sh2"
               line = wxLineShape()
        line.shapes = (sh1.num, sh2.num)
        line.SetCanvas(self)
        line.SetPen(wxBLACK_PEN)
        line.SetBrush(wxBLACK_BRUSH)
        line.AddArrow(ARROW_ARROW)
        line.MakeLineControlPoints(4)
        line.SetSpline(FALSE)
        line.Initialise()
        sh1.AddLine(line, sh2)
        self.NewShape(line,x,y,None,None,None)
        line.Show(true)
        #move to the same position the two objects connected to the line, so that can be posicionated correctly
        sh1.Move(self.dc, sh1.GetX(), sh1.GetY())
        sh2.Move(self.dc, sh2.GetX(), sh2.GetY())

···

#----
        self.Redraw(self.dc)
        self.Refresh()
        return line

If I run my program with /line.MakeLineControlPoints(2)/, two control points are drawn: one in the start and the other in the end of the line.
But with /line.MakeLineControlPoints(n) n>2/, only three control points are drawn...
Someone can tell me if wxLineShape::MakeLineControlPoints(int /n/) works, or if there is a bug? I'm using wxPython 24.4 for Python 2.3.
Any sugestions are wellcome :slight_smile:

Thanks in advance, Tânia

take a look of line._lineControlPoints list.
Might be that the central points (not ending ones) have all the same x,y
coords, so you see them overlapped

Alle 13:17, martedì 26 ottobre 2004, Tânia ha scritto:

···

To insert a line in my canvas I'm doing the following:

def AddLine(self, sh1, sh2, x, y):
        ''' Add a line to connect two objects: sh1, sh2"

        line = wxLineShape()
        line.shapes = (sh1.num, sh2.num)
        line.SetCanvas(self)
        line.SetPen(wxBLACK_PEN)
        line.SetBrush(wxBLACK_BRUSH)
        line.AddArrow(ARROW_ARROW)
        line.MakeLineControlPoints(4)
        line.SetSpline(FALSE)
        line.Initialise()
        sh1.AddLine(line, sh2)
        self.NewShape(line,x,y,None,None,None)
        line.Show(true)
        #move to the same position the two objects connected to the
line, so that can be posicionated correctly
        sh1.Move(self.dc, sh1.GetX(), sh1.GetY())
        sh2.Move(self.dc, sh2.GetX(), sh2.GetY())
        #----
        self.Redraw(self.dc)
        self.Refresh()
        return line

If I run my program with /line.MakeLineControlPoints(2)/, two control
points are drawn: one in the start and the other in the end of the line.
But with /line.MakeLineControlPoints(n) n>2/, only three control points
are drawn...
Someone can tell me if wxLineShape::MakeLineControlPoints(int /n/)
works, or if there is a bug? I'm using wxPython 24.4 for Python 2.3.
Any sugestions are wellcome :slight_smile:

Thanks in advance, Tânia

---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org

giuseppe massimo bertani <gm_bertani@yahoo.it> writes:

> take a look of line._lineControlPoints list.
> Might be that the central points (not ending ones) have all the same x,y
> coords, so you see them overlapped
>
Yes, all non-end points get the same coordinates. I thought of changing this
in the new version, but couldn't decide on a reasonable solution.

···

--
  Pierre Hjälm