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 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98
| class Ma_Frame(wx.Frame):
def __init__(self, parent, id, log):
wx.Frame.__init__(self, parent, id, 'MAT', size=(800, 500))
self.log = log
self.CenterOnScreen()
#pour le mettre en grand :
#self.Maximize(True)
# on lance les menus
Mes_Menus(self,log)
# on lance l'affichage de la page d'accueil
Page_Acceuil(self,log)
#---------------------------------------------------------------------------
class Mes_Menus:
"Contient les menus"
[...] # supprime pour plus de lisibilite
#---------------------------------------------------------------------------
class Page_Acceuil(wx.Panel):
def __init__(self,parent,log):
self.log=log
self.parent=parent
wx.Panel.__init__(self, parent, -1)
#Sizer
sizer_Vertical=wx.BoxSizer(wx.VERTICAL)
#Message d'acceuil
str="""
hello
"""
tc = wx.StaticText(self, -1,str,style=wx.ALIGN_CENTER)
font=wx.Font(25,wx.FONTFAMILY_DECORATIVE,wx.NORMAL,wx.NORMAL)
tc.SetFont(font)
sizer_Vertical.Add(tc,0,wx.ALIGN_CENTER)
b = wx.Button(self, 20, "importer") ##, (120, 45))
self.Bind(wx.EVT_BUTTON, self.OnClick, b)
b.SetToolTipString(" Importation des configuration \n depuis un dossier ou un fichier ")
sizer_Vertical.Add(b,0,wx.ALIGN_CENTER)
#Sizer Vertical
self.SetSizer(sizer_Vertical)
def OnClick(self,event):
Page_Acceuil_bis(self.parent,self.log)
self.Destroy()
#---------------------------------------------------------------------------
class Page_Acceuil_bis(wx.Panel):
def __init__(self,parent,log):
self.log=log
wx.Panel.__init__(self, parent, -1)
#Sizer
sizer_Vertical=wx.BoxSizer(wx.VERTICAL)
#Message d'acceuil
str="""
test
"""
tc = wx.StaticText(self, -1,str,style=wx.ALIGN_CENTER)
font=wx.Font(25,wx.FONTFAMILY_DECORATIVE,wx.NORMAL,wx.NORMAL)
tc.SetFont(font)
sizer_Vertical.Add(tc,0,wx.ALIGN_CENTER)
#Sizer Vertical
self.SetSizer(sizer_Vertical)
parent.Refresh(True)
parent.Update()
#---------------------------------------------------------------------------
class Log:
def WriteText(self, text):
if text[-1:] == '\n':
text = text[:-1]
wx.LogMessage(text)
write = WriteText
#---------------------------------------------------------------------------
class Run(wx.App):
def __init__(self):
wx.App.__init__(self,redirect=False)
# on veut que les logs aillent sur la console
wx.Log_SetActiveTarget(wx.LogStderr())
# creation de la fenetre
win = Ma_Frame(None,wx.ID_ANY,Log())
win.Show(True)
app=Run()
app.MainLoop() |
Partager