Citation :
import wx
class FrameConnexion(wx.Frame):
# Creation de la fenetre avec taille et position d origine
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, -1, title, pos=(500, 400), size=(411, 306))
# Creation d une barre de menu
menuBar = wx.MenuBar()
menu = wx.Menu()
#Fonction QUIT dans la barre
menu.Append(wx.ID_EXIT, "E&xit\tAlt-X", "Exit the program" )
self.Bind(wx.EVT_MENU, self.OnQuitButton, id=wx.ID_EXIT)
menuBar.Append(menu, "&File" )
self.SetMenuBar(menuBar)
# create a status bar at the bottom of the frame
self.CreateStatusBar()
# create a panel (between menubar and statusbar) ...
panel = wx.Panel(self)
text_loggin = wx.StaticText(panel, -1, "Loggin" )
text_loggin.SetFont(wx.Font(24, wx.SCRIPT, wx.NORMAL, wx.BOLD))
text_loggin.SetSize(text.GetBestSize())
text_password = wx.StaticText(panel, -1, "Password" )
text_password.SetFont(wx.Font(24, wx.SCRIPT, wx.NORMAL, wx.BOLD))
text_password.SetSize(text.GetBestSize())
btn_valid = wx.Button(panel, -1, "Valider" )
self.Bind(wx.EVT_BUTTON, self.OnValidButton, btn_valid)
sizer = wx.BoxSizer(wx.VERTICAL)
sizer.Add(text_loggin, 0, wx.ALL, 10)
sizer.Add(text_password, 0, wx.ALL, 10)
sizer.Add(btn_valid, 0, wx.ALL, 10)
panel.SetSizer(sizer)
panel.Layout()
def OnValidButton(self, evt):
# fonction connexion
self.Close()
class wxPyApp(wx.App):
def OnInit(self):
frame = FrameConnexion(None, "Fenetre" )
self.SetTopWindow(frame)
frame.Show(True)
return True
app = wxPyApp(redirect=True)
app.MainLoop()
|