To get you started, here is some sample code for a possible approach to the
problem (with 3 graphs). BTW, this is totally off the top of my head and
untested as well (I've got to leave you something
class MyPanel(wxPanel):
def __init__(self, parent, ...):
wxPanel.__init__(self, parent, ...)
self.graphs = [
wxEmptyBitmap(256, 256),
wxEmptyBitmap(256, 256),
wxEmptyBitmap(256, 256),
]
choices = [str(i) for i in range(len(self.graphs))]
self.checks = wxCheckListbox(self, parent, -1, choices = choices)
self.DrawGraphs() # doesn't actually draw to the panel!
EVT_PAINT(self, self.OnPaint)
...
def DrawGraphs(self):
memDC = wxMemoryDC()
for graph in self.graphs:
mask = wxEmptyBitmap(graph.GetWidth(), graph.GetHeight,
depth = 1)
memDC.SelectObject(graph)
### insert your drawing code here
...
# draw the graph again into the mask
memDC.SelectObject(mask)
### insert your drawing code here
...
graph.SetMask(wxMask(mask))
memDC.SelectObject(wxNullBitmap)
def OnPaint(self, event):
dc = wxPaintDC(self)
self.Draw(dc)
def Draw(self, dc)
memDC = wxMemoryDC()
for i in range(len(self.graphs)):
if self.checks.IsChecked(i):
memDC.SelectObject(self.graphs[i])
dc.Blit(0, 0, self.graphs[i].GetWidth(),
self.graphs[i].GetHeight(), memDC, 0, 0,
wxCOPY, true)
memDC.SelectObject(wxNullBitmap)
Note that instead of drawing the graphs twice (once for the graph, once for
the mask), you could use wxMaskColour, but in my experience this method is
much faster.
Have fun.
···
On Tuesday 04 September 2001 02:13, you wrote:
I guess I have to make it in the second way (bitmaps and masks), because I
have to overlay some graphs, sometimes. I hope I can manage it, 'cause I'm
an absolut newbie!!
--
Cliff Wells
Software Engineer
Logiplex Corporation
(503) 978-6726 x308
(800) 735-0555 x308