title: wxPython - Align buttons in an expanding sizer
body: <p>I'm trying to make a dialog that looks similar to the wx.MessageDialog. There's a section at the bottom that coloured different but in my code, the buttons will not cooperate.</p>
  
  <p>The buttons should be aligned right, and the bottom section should expand to colour it grey. There's probably a simple solution, anyone able to see my error?</p>
  
  <p><strong>This is with the sizer set to expand</strong>:</p>
  
  <p><a href="https://i.stack.imgur.com/ZHLlG.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/ZHLlG.png" alt="enter image description here"></a></p>
  
  <p><strong>This is with the sizer set not to expand</strong>:</p>
  
  <p><a href="https://i.stack.imgur.com/kH7ij.png" rel="nofollow noreferrer"><img src="https://i.stack.imgur.com/kH7ij.png" alt="enter image description here"></a></p>
  
  <p>Here's a working simplified version of the code which demonstrates the issue. The troublesome code is at the bottom, surrounded with "===":</p>
  
  <pre><code>import wx
  
  class TestDialog(wx.Dialog):
      def __init__(self, parent, msg, title):
          wx.Dialog.__init__(self, parent, id=-1, title=title)
          # outer sizer, this is to allow a spot at the bottom for the buttons
          outerSizer = wx.BoxSizer(wx.VERTICAL)
  
          # Main sizer for the message dialog
          mainSizer = wx.BoxSizer(wx.HORIZONTAL)
  
          staticIcon = wx.StaticBitmap(self, bitmap=wx.ArtProvider.GetBitmap(wx.ART_INFORMATION), size=(32,32))
          mainSizer.Add(staticIcon, flag=wx.ALL, border=10)
  
          # Sizer to hold the message and buttons
          controlsSizer = wx.BoxSizer(wx.VERTICAL)
  
          # Static text field to show the (error/warning) message on the message dialog
          errorText = wx.StaticText(self, -1, msg, wx.DefaultPosition, wx.DefaultSize, 0)
          errorText.Wrap(600)
  
          # This is a sizer so we can nest it inside the controls sizer. This allows us to use multiple border flags
          errorTextSizer = wx.BoxSizer(wx.HORIZONTAL)
          errorTextSizer.Add(errorText, flag=wx.TOP, border=15)
  
          # Add the error text to the controls sizer
          controlsSizer.Add(errorTextSizer, flag=wx.RIGHT, border=10)
  
          # Outer button panel, to get that slighty greyed look
          outerButtonPanel = wx.Panel(self)
          outerButtonPanelSizer = wx.BoxSizer(wx.HORIZONTAL)
          outerButtonPanel.SetSizer(outerButtonPanelSizer)
  
          # Button for the "yes" option
          btnYes = wx.Button(outerButtonPanel, label='Yes')
          btnYes.Bind(wx.EVT_BUTTON, self.__yes)
          outerButtonPanelSizer.Add(btnYes, flag=wx.ALIGN_RIGHT | wx.ALL, border=15)
  
          # Button for the "no" option
          btnNo = wx.Button(outerButtonPanel, label='No')
          btnNo.Bind(wx.EVT_BUTTON, self.__no)
          outerButtonPanelSizer.Add(btnNo, flag=wx.ALIGN_RIGHT | wx.RIGHT | wx.TOP | wx.BOTTOM, border=15)
  
          outerButtonPanel.SetBackgroundColour(wx.Colour(100, 100, 100)) # find decent colour
  
          # Add all the sizers to each other, finish up
          mainSizer.Add(controlsSizer)
          outerSizer.Add(mainSizer)
  
          # ====================================================================
          outerSizer.Add(outerButtonPanel, flag=wx.ALIGN_RIGHT | wx.EXPAND)
          # ====================================================================
          #outerSizer.Add(outerButtonPanel, flag=wx.ALIGN_RIGHT)
          # ====================================================================
  
          # Done layout
          self.SetSizerAndFit(outerSizer)
          self.CenterOnScreen()
  
      def __yes(self, evt):
          self.EndModal(wx.ID_YES)
  
      def __no(self, evt):
          self.EndModal(wx.ID_NO)
  
  if __name__ == '__main__':
      app = wx.App()
      dlg = TestDialog(None, "test test test test test test test test test test test test test test test test", "Test Title")
      val = dlg.ShowModal()
      print "Dialog result: " + str(val == wx.ID_YES)
      app.Exit()
  </code></pre>