I would normally attach my entire source code, but I don’t think I need to for this one. I think this screenshot will suffice: http://yfrog.com/n2editorscreenshotp
If you look at the screenshot, you will notice two colored bars, one black and one green. These are colored panels. Obviously, the way it is now is a bit ugly; what I wanted was for the panels to be small colored boxes that show the selected color.
This particular panel is set up with a vertical box sizer containing 5 horizontal box sizers.
How can I prevent the sizers from stretching the panels out like they are now, while still having everything else as it is? Is it possible to make the sizer align them across the frame without stretching anything? When I tried setting the second argument in hbox.Add() to 0, nothing was resized, but everything was just squished together, almost as if I hadn’t passed the ALIGN_* flags at all.
Here’s the code snippet where the panels are:
label = wx.StaticText(settings, -1, ‘Background Color:’, (10,40))
self.pnlBackgroundColor = wx.Panel(settings, -1, size=(32,16))
r,g,b = sets[‘bgcolor’]
self.pnlBackgroundColor.SetBackgroundColour(wx.Colour(r,g,b))
self.btnBackgroundColor = wx.Button(settings, -1, ‘Change’)
self.Bind(wx.EVT_BUTTON,self.OnBackgroundColor,self.btnBackgroundColor)
hbox2.Add(label, 1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL)
hbox2.Add(self.pnlBackgroundColor, 1, wx.ALIGN_CENTER)
hbox2.Add(self.btnBackgroundColor, 1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)
label = wx.StaticText(settings, -1, ‘Line Color:’)
self.pnlLineColor = wx.Panel(settings, -1, size=(32,16))
r,g,b = sets[‘lncolor’]
self.pnlLineColor.SetBackgroundColour(wx.Colour(r,g,b))
self.btnLineColor = wx.Button(settings, -1, ‘Change’)
self.Bind(wx.EVT_BUTTON, self.OnLineColor, self.btnLineColor)
hbox3.Add(label, 1, wx.ALIGN_LEFT|wx.ALIGN_CENTER_VERTICAL)
hbox3.Add(self.pnlLineColor, 1, wx.ALIGN_CENTER)
hbox3.Add(self.btnLineColor, 1, wx.ALIGN_RIGHT|wx.ALIGN_CENTER_VERTICAL)