Hi,
newbie to wxPython. Trying things out. Is there a way to add
resize-able space without using a control, which is the only way I've
managed to do it.
below is what I've done.
cheers,
Jonathan
···
--------------------------------------------------------------------------
class MyPanel(wx.Panel):
def __init__(self, parent, id):
wx.Panel.__init__(self, parent, id, style=wx.RAISED_BORDER)
self.box=wx.BoxSizer(wx.HORIZONTAL)
self.box.Add(wx.StaticText(self, -1, label = " "), 1,
wx.EXPAND)
self.box.Add(wx.Button(self, -1, 'Button One'), 0)
self.box.Add(wx.StaticText(self, -1, label = " "), 1,
wx.EXPAND)
self.box.Add(wx.Button(self, -1, 'Button Two'), 0, wx.EXPAND)
self.box.Add(wx.StaticText(self, -1, label = " "), 1,
wx.EXPAND)
self.SetSizer(self.box)
self.box.SetSizeHints(self)
class MyFrame(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, -1, title)
self.box=wx.BoxSizer(wx.VERTICAL)
self.box.Add(wx.StaticText(self, -1, label = " "), 1,
wx.EXPAND)
self.box.Add(MyPanel(self, -1), 0, wx.EXPAND)
self.SetAutoLayout(True)
self.SetSizerAndFit(self.box)
#self.box.SetSizeHints(self)
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, -1, title="Sizer Test")
self.SetTopWindow(frame)
frame.Show(True)
return True
if __name__ == '__main__':
app = MyApp(0)
app.MainLoop()