Buttons overlap each other
<p>I have the following code:</p>

<pre><code>    self.btn1 = wx.Button(self, -1, _("a"))
    self.btn2 = wx.Button(self, -1, _("b"))
    btnSizer = wx.BoxSizer(wx.HORIZONTAL)
    btnSizer.Add(self.btn1 , 0, wx.RIGHT, 10)
    btnSizer.Add(self.btn2 , 0, wx.RIGHT, 10)
</code></pre>

<p>This works well.
However there is a case where I change the title of <code>btn2</code> :</p>

<pre><code>self.btn1.SetLabel('bbbbb')
</code></pre>

<p>When I do that <code>btn1</code> overlaps <code>btn2</code>....</p>

<p>first row is the original 
second row is after set label.</p>

<p><a href="http://i.stack.imgur.com/hi1zP.png" rel="nofollow"><img src="http://i.stack.imgur.com/hi1zP.png" alt="enter image description here"></a></p>

<p>How do I make the screen refresh to the new size of buttons?</p>

<p>You can use <code>self.Layout()</code> but in this case it really shouldn't be necessary. There must be some issue that you are having with your code.</p>

<pre><code>import wx

class ButtonFrame(wx.Frame):
    def __init__(self, value):
        wx.Frame.__init__(self,None)
        self.btn1 = wx.Button(self, -1, ("a"))
        self.btn2 = wx.Button(self, -1, ("b"))
        self.btnSizer = wx.BoxSizer(wx.HORIZONTAL)
        self.btnSizer.Add(self.btn1 , 0, wx.RIGHT, 10)
        self.btnSizer.Add(self.btn2 , 0, wx.RIGHT, 10)
        self.btn1.Bind(wx.EVT_BUTTON, self.OnPressA)
        self.btn2.Bind(wx.EVT_BUTTON, self.OnPressB)
        self.SetSizer(self.btnSizer)
        self.Centre()
        self.Show()

    def OnPressA(self,evt):
        self.btn1.SetLabel('bbbbbbbbbbbbbbbbbbbbbbbbbb')
#        self.Layout()

    def OnPressB(self,evt):
        self.btn2.SetLabel('aaaaaaaaaaaaaaaaaaaaaaaaaa')
#        self.Layout()

if __name__ == "__main__":
    app = wx.App(False)
    ButtonFrame(None)
    app.MainLoop()
</code></pre>

python wxpython