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 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57
| class Fenetre(wx.Frame):
def __init__(self, parent, id, title):
wx.Frame.__init__(self, parent, id, title, size=(800,800))
## Canvas et barre latérale
self.cnv = wx.Panel(self,-1)
self.barre = wx.Panel(self,-1)
self.dc=wx.ClientDC(self.cnv)
## Création sizers
vbox = wx.BoxSizer(wx.VERTICAL)
hbox = wx.BoxSizer(wx.HORIZONTAL)
## Boutons
self.bouton_anime=wx.Button(self.barre,0,"Animer !")
self.bouton_stop=wx.Button(self.barre,1,"Stop !")
## Barre latérale
self.barre.SetSizer(vbox)
vbox.Add(self.bouton_anime,0,wx.ALIGN_CENTER | wx.EXPAND,5)
vbox.Add(self.bouton_stop,0,wx.ALIGN_CENTER | wx.EXPAND,5)
## Création du menu
menu = wx.MenuBar()
fichier = wx.Menu()
aide = wx.Menu()
fichier.Append(101,'&Animer', "Lancer le feu d'artifice!")
fichier.Append(102,'&Quitter', "Quitter l'application")
aide.Append(201,'&A propos', "blabla")
menu.Append(fichier, '&Fichier')
menu.Append(aide, '&Aide')
self.SetMenuBar(menu)
self.CreateStatusBar()
## Sizer Global
self.SetSizer(hbox)
hbox.Add(self.cnv, 3, wx.EXPAND)
hbox.Add(self.barre, 2, wx.EXPAND) |
Partager