Hello everybody,
Hopefully one of you will have some time to look at the code that follows.
I don't understand why only the first rectangle responds to a dragging event.
What is missing?
Thanks
Alban
···
-----------------------------------------------
from wxPython.wx import *
from wxPython.ogl import *
wxOGLInitialize()
class MyShapeCanvas(wxShapeCanvas):
def __init__(self, parent):
wxShapeCanvas.__init__(self, parent)
self.diagram = wxDiagram()
self.SetDiagram(self.diagram)
self.diagram.SetCanvas(self)
self.shapes = []
class MyApp(wxApp):
def OnInit(self):
frame = wxFrame(NULL, -1, "Testing OGL", size=wxSize(400, 400))
myCanvas = MyShapeCanvas(frame)
# add a rectangle
aRect = wxRectangleShape(100, 80)
aRect.SetX(100)
aRect.SetY(100)
myCanvas.diagram.AddShape(aRect)
aRect.Show(true)
# myCanvas.shapes.append(aRect)
# add another rectangle
aShape = wxDrawnShape()
aShape.DrawRectangle(wxRect(200, 200, 100, 80))
myCanvas.diagram.AddShape(aShape)
aShape.Show(true)
# myCanvas.shapes.append(aShape)
frame.Show(true)
self.SetTopWindow(frame)
return true
app = MyApp(0)
app.MainLoop()
-----------------------------------------------
_________________________________________________________________
Protect your PC - get McAfee.com VirusScan Online http://clinic.mcafee.com/clinic/ibuy/campaign.asp?cid=3963