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
| #-*- coding: utf-8 -*-
import wx
class MenuLeft():
def __init__(self, parent):
pnl = wx.Panel(parent, -1, pos = (0,0), size = (185, 800))
self.btn = wx.Button(pnl, 100, u"Ajouter", pos = (5, 150), size = (175,-1))
#wx.EVT_BUTTON(self, 100, Page1.Ajout(Page1)) ### C'est ici que ça bug
class MenuPrincipal():
def __init__(self, parent):
self.page = wx.Notebook(parent, -1, pos = (200,0), size = (900, 800))
Page1(self.page)
class Page1():
def __init__(self, parent):
pnl = wx.Panel(parent, -1, pos = (200,0), size = (900, 800))
pnl.SetBackgroundColour(wx.LIGHT_GREY)
parent.AddPage(pnl, "Fiche Client")
txt1 = wx.StaticText(pnl, -1, u"texte 1", pos = (5,5))
self.txt = wx.TextCtrl(pnl, -1, pos = (70, 2), size = (90, -1), style = wx.TE_READONLY)
def Ajout(self):
self.code.SetEditable(1)
print "ok"
class Root(wx.Frame):
def __init__(self, titre):
wx.Frame.__init__(self, None, -1, title = titre, size = (1100,800))
self.Center(True)
self.SetSizeHints(self.GetSize().x,self.GetSize().y,self.GetSize().x,self.GetSize().y)
menuFichier = wx.Menu()
menuFichier.Append(wx.ID_EXIT, "Quitter", u"Quitter le programme")
menuOutil = wx.Menu()
menuBarre = wx.MenuBar()
menuBarre.Append(menuFichier, "Fichier")
menuBarre.Append(menuOutil, "Outils")
self.SetMenuBar(menuBarre)
MenuLeft(self)
MenuPrincipal(self)
class MonApp(wx.App):
def OnInit(self):
fen = Root(u'TOTO')
fen.Show(True)
self.SetTopWindow(fen)
return True
app = MonApp()
app.MainLoop() |
Partager