Hi
I am using sizers to layout a simple UI. The UI elements consist of graphics files that are loaded into wx.StaticBitmaps. Sizers control the layout of this so that there is 3 rows. The top and bottom rows are fixed in height, but may expand horizontally through an expanding "repeater" bitmap. The centre row has a panel that stretches both ways.
Problem is that when the frame is resized to a smaller size I am getting corruption of the wx.StaticBitmaps on the bottom row of the layout. In the code below, the top and bottom rows are set up in exactly the same manner, so there seems to be some kind of interaction with the vertical resize, or maybe its just a bug.
Anyone know what's going on?
Thanks.
Code is:
···
-----------------------
import wx
class MyFrame(wx.Frame):
def __init__(self, parent, id, title):
myStyle = wx.DEFAULT_FRAME_STYLE|wx.NO_FULL_REPAINT_ON_RESIZE
wx.Frame.__init__(self, parent, id, title, style=myStyle)
bmp1 = wx.StaticBitmap(self,-1, bitmap=wx.Image('left.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap())
bmp2 = wx.StaticBitmap(self,-1, bitmap=wx.Image('repeater.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap())
bmp3 = wx.StaticBitmap(self,-1, bitmap=wx.Image('right.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap())
bmp4 = wx.StaticBitmap(self,-1, bitmap=wx.Image('left.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap())
bmp5 = wx.StaticBitmap(self,-1, bitmap=wx.Image('repeater.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap())
bmp6 = wx.StaticBitmap(self,-1, bitmap=wx.Image('right.png', wx.BITMAP_TYPE_PNG).ConvertToBitmap())
p = wx.Panel(self,-1, size=wx.Size(400,300), style=wx.SUNKEN_BORDER)
p.SetBackgroundColour("BLACK")
box1 = wx.BoxSizer(wx.HORIZONTAL)
box1.Add(bmp1, 0, 0)
box1.Add(bmp2, 1, wx.EXPAND)
box1.Add(bmp3, 0, 0)
box2 = wx.BoxSizer(wx.HORIZONTAL)
box2.Add(10, 10, 0, 0) #spacer
box2.Add(p, 1, wx.EXPAND)
box2.Add(10, 10, 0, 0) #spacer
box3 = wx.BoxSizer(wx.HORIZONTAL)
box3.Add(bmp4, 0, 0)
box3.Add(bmp5, 1, 0)
box3.Add(bmp6, 0, 0)
mainSizer = wx.BoxSizer(wx.VERTICAL)
mainSizer.Add(box1, 0, wx.EXPAND)
mainSizer.Add(box2, 1, wx.EXPAND)
mainSizer.Add(box3, 0, wx.EXPAND)
# mainSizer.SetSizeHints(self)
self.SetAutoLayout(1)
self.SetSizer(mainSizer)
self.Fit()
self.Layout()
app = wx.PySimpleApp()
frame = MyFrame(None, -1, "Sizer Test")
frame.Show(1)
app.MainLoop()