Please make a runnable, small as possible, sample application that demonstrates the problem, and let us know the platform and wx version you are using. MakingSampleApps - wxPyWiki
···
On 12/21/12 3:54 AM, Adri�n Morales Torres wrote:
I would like to draw a selection rectangle when I drag with left button
in an ogl canvas written with wxpython. I have written the following
code to draw the selection rectangle for the OnDragLeft event:def OnDragLeft(self, draw, x, y, keys = 0, attachment = 0):
dc = wx.ClientDC(self)
del self ["SELEC"]
self.GetDiagram().Clear(dc)
self.update()
self ["SELEC"] = ogl.RectangleShape(abs(x-self.xini),
abs(y-self.yini))
self ["SELEC"].SetX((self.xini+x)/2)
self ["SELEC"].SetY((self.yini+y)/2)
self ["SELEC"].SetPen(wx.Pen((130,130,130), style=wx.DOT))
self ["SELEC"].SetBrush(wx.TRANSPARENT_BRUSH)
self ["SELEC"].Show(True)
self ["SELEC"].Draw(dc)self.xini and self.yini are the initial coordinates of the selection
rectangle. It works properly but the canvas is continuously being
refreshed, what makes the process slow. Do you know how could I draw
this rectangle without refreshing the canvas in each step?
--
Robin Dunn
Software Craftsman