Draws in wxShapeCanvas

This may not be related, but a problem I've been having in OGL is that,
after attaching a line to a shape, the line doesn't show up unless the
shape is moved. I finally worked around it by adding the ForceMove method
to my shape objects and calling it whenever necessary:

  def ForceMove(self, dc = None):
    if dc == None:
      canvas = self.GetCanvas()
      dc = canvas.DcGet()
    
    self.Move(dc, self.GetX(), self.GetY())

Lame, but it gets the job done.

  Matthew

···

-----Original Message-----
From: Diego Prestes [mailto:lobow@brturbo.com]
Sent: Wednesday, May 21, 2003 11:15 AM
To: wxpython-users@lists.wxwindows.org
Subject: [wxPython-users] Draws in wxShapeCanvas

Hello!
I have a wxShapeCanvas but when I use the mouse for insert a circle(for
example) I just can see the draw if I move his position with the mouse
else its stay 'hidden'. I dont know whats happening because I use the
same commands when I create a static draw. Here is some part of the code
if someone could help, tks.
Diego

        self.rightwin =
MyShape(self,20,wxPoint(self.size[0],0),wxSize(300,300))
        self.shapes=[]
        self.form=0
        EVT_RIGHT_UP(self.rightwin, self.Draw)

    def Draw(self, event):
        if (self.form == 1):
            shape=wxRectangleShape(50,50)
            shape.SetX(event.GetX())
            shape.SetY(event.GetY())
            self.rightwin.diagram.AddShape(shape)
            shape.Show(true)
            self.shapes.append(shape)
        if (self.form == 2):
            shape=wxCircleShape(50)
            shape.SetX(event.GetX())
            shape.SetY(event.GetY())
            self.rightwin.diagram.AddShape(shape)
            shape.Show(true)
            self.shapes.append(shape)

class MyShape(wxShapeCanvas):
    def __init__(self, parent, ID, pos, size):
        wxShapeCanvas.__init__(self, parent, ID, pos=wxPoint(40,0),
size=wxSize(300,300))
        self.SetBackgroundColour(wxWHITE)
        self.diagram = wxDiagram()
        self.SetDiagram(self.diagram)
        self.diagram.SetCanvas(self)

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