alligment of objects in wxpython
Question: I added some buttons to BoxSizer. This I what I wanted: [![enter image
description
here](http://i.stack.imgur.com/HN4T5.png)](http://i.stack.imgur.com/HN4T5.png)

This is what I go: [![enter image description
here](http://i.stack.imgur.com/uXkQR.png)](http://i.stack.imgur.com/uXkQR.png)

This is the code for the 2nd Box:

    
    
        self.approveItem = wx.Button(self.panel_1, -1, "Approve Item")
        self.changeQty = wx.Button(self.panel_1, -1, "Change Qty")
        sizer_2 = wx.BoxSizer(wx.HORIZONTAL)
        sizer_2.Add(self.approveItem, 0, wx.ALIGN_RIGHT | wx.RIGHT, 0)
        sizer_2.Add(self.changeQty, 0, wx.ALIGN_RIGHT| wx.RIGHT, 0)
        self.sizer_item_staticbox = wx.StaticBox(self, -1, "")
        sizer_item = wx.StaticBoxSizer(self.sizer_item_staticbox, wx.HORIZONTAL)
        sizer_item.SetMinSize((600,-1))
        sizer_item.Add(sizer_2, 0, wx.EXPAND, 0)    
    

how do I fix it?


Answer: There are quite a few ways to achieve what you want, including using a
flexgridsizer, a gridsizer and just normal horizontal and vertical boxsizers,
here is a gridsizer example.  
I have made it 5 columns wide, so that you can insert extra buttons on the
left hand side if you so wish.  
See: <http://wxpython.org/Phoenix/docs/html/GridSizer.html>

    
    
    #!/usr/bin/env python
    import wx
    class MyFrame(wx.Frame):
        def __init__(self, parent, ID, title):
            wx.Frame.__init__(self, parent, ID, title, wx.DefaultPosition)
            Buttons = []
            Buttons.append(wx.Button(self,-1, "Approve Location"))
            Buttons.append(wx.Button(self,-1, "Approve Item"))
            Buttons.append(wx.Button(self,-1, "Change Qty"))
            Buttons.append(wx.Button(self,-1, "Approve"))
            sizer = wx.GridBagSizer(5,3)
            sizer.Add(Buttons[0], (0, 5), (1,1), wx.EXPAND)
            sizer.Add(Buttons[1], (1, 4), (1,1), wx.EXPAND)
            sizer.Add(Buttons[2], (1, 5), (1,1), wx.EXPAND)
            sizer.Add(Buttons[3], (2, 5), (1,1), wx.EXPAND)
            self.SetSizerAndFit(sizer)
            self.Centre()
    class MyApp(wx.App):
        def OnInit(self):
            frame = MyFrame(None, -1, "Gridbagsizer")
            frame.Show(True)
            self.SetTopWindow(frame)
            return True
    if __name__ == "__main__":
        app = MyApp(0)
        app.MainLoop()
    

