Files
Phoenix/docs/sphinx/_downloads/GridBagSizer.1.py
Andrea Gavana 94c66c0a34 Phoenix updates:
1) Keep the sidebar always visible;
2) Put the search stuff on the scrolling header;
3) Implement accordion-style JavaScrip stuff to show/hide user-contributed samples;
4) Minor clean-ups.

git-svn-id: https://svn.wxwidgets.org/svn/wx/wxPython/Phoenix/trunk@71087 c3d73ce0-8a6f-49c7-b76d-6d57e0e08775
2012-04-03 18:41:48 +00:00

47 lines
1.1 KiB
Python

##Chris Barker
#!/usr/bin/env python
"""
A simple test of the GridBagSizer
http://wiki.wxpython.org/index.cgi/WriteItYourself
"""
import wx
class MyFrame(wx.Frame):
def __init__(self, parent, ID, title):
wx.Frame.__init__(self, parent, ID, title, wx.DefaultPosition)
Buttons = []
for i in range(6):
Buttons.append(wx.Button(self,-1, "Button %i"%(i)))
sizer = wx.GridBagSizer(9, 9)
sizer.Add(Buttons[0], (0, 0), wx.DefaultSpan, wx.ALL, 5)
sizer.Add(Buttons[1], (1, 1), (1,7), wx.EXPAND)
sizer.Add(Buttons[2], (6, 6), (3,3), wx.EXPAND)
sizer.Add(Buttons[3], (3, 0), (1,1), wx.ALIGN_CENTER)
sizer.Add(Buttons[4], (4, 0), (1,1), wx.ALIGN_LEFT)
sizer.Add(Buttons[5], (5, 0), (1,1), wx.ALIGN_RIGHT)
sizer.AddGrowableRow(6)
sizer.AddGrowableCol(6)
self.SetSizerAndFit(sizer)
self.Centre()
class MyApp(wx.App):
def OnInit(self):
frame = MyFrame(None, -1, "wx.gridbagsizer.py")
frame.Show(True)
self.SetTopWindow(frame)
return True
if __name__ == "__main__":
app = MyApp(0)
app.MainLoop()