1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32
| #!/usr/bin/python
#-*- coding: utf-8 -*-
import wx
class Panneau(wx.Panel):
def __init__(self, parent):
wx.Panel.__init__(self, parent, -1, size = (500, 400))
sizer = wx.GridBagSizer(3, 2)
sizer.Add(wx.Button(self, -1, "bouton 1"),(0, 0))
sizer.Add(wx.Button(self, -1, "bouton 2"),(1, 0), (1, 2), wx.EXPAND)
sizer.Add(wx.Button(self, -1, "bouton 3"),(2, 0))
sizer.Add(wx.Button(self, -1, "bouton 4"),(2, 1))
self.SetSizer(sizer)
class Fenetre(wx.Frame):
def __init__(self):
wx.Frame.__init__(self, None, -1, title = "GridBagSizer")
sizer = wx.BoxSizer(wx.HORIZONTAL)
sizer.Add(Panneau(self), 1, wx.EXPAND)
self.SetSizer(sizer)
self.Fit()
class MonApp(wx.App):
def OnInit(self):
f = Fenetre()
f.Show(True)
self.SetTopWindow(f)
return True
app = MonApp()
app.MainLoop() |
Partager