I think that what is wrong is this line:
self.GetSizer().Add(self.fileNameSizer)
There should be some of proportion=1
and/or flag=wx.EXPAND
to make the nested sizer match its master size.
Something like this:
import wx
class MainWindow(wx.Frame):
def __init__(self, *args, **kwargs):
wx.Frame.__init__(self, *args, **kwargs)
self.panel = wx.Panel(self)
self.label = wx.StaticText(self.panel, label="Label")
self.text = wx.TextCtrl(self.panel)
self.button = wx.Button(self.panel, label="Test")
self.button1 = wx.Button(self.panel, label="ABOVE")
self.button2 = wx.Button(self.panel, label="BELLOW")
self.horizontal = wx.BoxSizer()
self.horizontal.Add(self.label, flag=wx.CENTER)
self.horizontal.Add(self.text, proportion=1, flag=wx.CENTER)
self.horizontal.Add(self.button, flag=wx.CENTER)
self.vertical = wx.BoxSizer(wx.VERTICAL)
self.vertical.Add(self.button1, flag=wx.EXPAND)
self.vertical.Add(self.horizontal, proportion=1, flag=wx.EXPAND)
self.vertical.Add(self.button2, flag=wx.EXPAND)
self.panel.SetSizerAndFit(self.vertical)
self.Show()
app = wx.App(False)
win = MainWindow(None)
app.MainLoop()
BTW: Please stop adding space before (
in method calls. Also I would recommend object oriented approach so you do not loose access to your GUI objects.