Reputation: 341
I have an application that has a panel on which static bitmaps (wx.StaticBitmap) are placed in a GridBagSizer. I want to place a bitmap on top of certain of the static bitmaps, that will partly cover it and its neighbours.
I've been trying like this:
self.panel = wx.Panel(self, -1, style=wx.TRANSPARENT_WINDOW)
self.panel.Bind(wx.EVT_PAINT, self.place_bitmap)
.
.
.
def place_bitmap(self, *args):
dc = wx.ClientDC(self.panel) # or wx.PaintDC(self.panel)
for xy in self.coordinates:
dc.DrawBitmap(self.top_bitmap, xy[0], xy[1], 0)
self.panel.Layout()
If I change the coordinates in dc.DrawBitmap()
to a place in self.panel
where there is no static bitmap, it shows.
But I can't get it to show on top of the static bitmaps.
So it seems it's getting rendered under them?
How can I make the top_bitmap go on top?
Upvotes: 0
Views: 139
Reputation: 22678
You can't draw on top of the child windows portably. The general solution is to create a child window of that child window and draw on it but in your case it probably would be simpler to just use a custom window instead of wxStaticBitmap
which is a trivially simple class anyhow -- then you'd be able to draw whatever you want in it.
Upvotes: 1