Hi,
I want to display a Frame2 when I clic the button4 in Frame1,my problem is when I clic in that button the Frame2 is not displayed this is my code:
#Boa:Frame:Frame1
import wx
import wx.animate
def create(parent):
return Frame1(parent)
[wxID_FRAME1, wxID_FRAME1BUTTON1, wxID_FRAME1BUTTON2, wxID_FRAME1BUTTON3,
wxID_FRAME1BUTTON4, wxID_FRAME1BUTTON5, wxID_FRAME1BUTTON6,
wxID_FRAME1GIFANIMATIONCTRL1, wxID_FRAME1PANEL1, wxID_FRAME1STATICTEXT1,
wxID_FRAME1STATICTEXT2, wxID_FRAME1STATICTEXT3, wxID_FRAME1STATICTEXT4,
wxID_FRAME1STATICTEXT5, wxID_FRAME1STATUSBAR1,
] = [wx.NewId() for _init_ctrls in range(15)]
class Frame1(wx.Frame):
def _init_coll_menuBar1_Menus(self, parent):
# generated method, don't edit
parent.Append(menu=wx.Menu(), title=u'Fichier')
parent.Append(menu=wx.Menu(), title=u'Bases')
parent.Append(menu=wx.Menu(), title=u'Saisies')
parent.Append(menu=wx.Menu(), title=u'Traitements')
parent.Append(menu=wx.Menu(), title=u'Editions')
parent.Append(menu=wx.Menu(), title=u'?')
def _init_utils(self):
# generated method, don't edit
self.menuBar1 = wx.MenuBar()
self._init_coll_menuBar1_Menus(self.menuBar1)
def _init_ctrls(self, prnt):
# generated method, don't edit
wx.Frame.__init__(self, id=wxID_FRAME1, name='', parent=prnt,
pos=wx.Point(369, 120), size=wx.Size(909, 728),
style=wx.DEFAULT_FRAME_STYLE, title=u'MasterCom')
self._init_utils()
self.SetClientSize(wx.Size(893, 690))
self.SetMenuBar(self.menuBar1)
self.statusBar1 = wx.StatusBar(id=wxID_FRAME1STATUSBAR1,
name='statusBar1', parent=self, style=0)
self.statusBar1.SetStatusText(u'')
self.SetStatusBar(self.statusBar1)
self.panel1 = wx.Panel(id=wxID_FRAME1PANEL1, name='panel1', parent=self,
pos=wx.Point(0, 0), size=wx.Size(893, 647),
style=wx.TAB_TRAVERSAL)
self.panel1.SetBackgroundColour(wx.Colour(175, 201, 235))
self.button2 = wx.Button(id=wxID_FRAME1BUTTON2, label=u'Plan Comptes',
name='button2', parent=self.panel1, pos=wx.Point(8, 80),
size=wx.Size(112, 40), style=0)
self.button2.Bind(wx.EVT_BUTTON, self.OnButton2Button,
id=wxID_FRAME1BUTTON2)
self.button1 = wx.Button(id=wxID_FRAME1BUTTON1,
label=u'Liste Ecritures', name='button1', parent=self.panel1,
pos=wx.Point(8, 248), size=wx.Size(112, 40), style=0)
self.button1.Bind(wx.EVT_BUTTON, self.OnButton1Button,
id=wxID_FRAME1BUTTON1)
self.button3 = wx.Button(id=wxID_FRAME1BUTTON3, label=u'Libell\xe9s',
name='button3', parent=self.panel1, pos=wx.Point(8, 120),
size=wx.Size(112, 40), style=0)
self.gIFAnimationCtrl1 = wx.animate.GIFAnimationCtrl(filename=u'D:\\Python27\\Lib\\site-packages\\boa-constructor\\Application\\images\\img_bk.gif',
id=wxID_FRAME1GIFANIMATIONCTRL1, name='gIFAnimationCtrl1',
parent=self.panel1, pos=wx.Point(128, 0), size=wx.Size(928, 664),
style=wx.animate.AN_FIT_ANIMATION|wx.NO_BORDER)
self.gIFAnimationCtrl1.SetBackgroundColour(wx.Colour(153, 170, 255))
self.staticText2 = wx.StaticText(id=wxID_FRAME1STATICTEXT2,
label=u' Exercices', name='staticText2', parent=self.panel1,
pos=wx.Point(0, 440), size=wx.Size(107, 23), style=0)
self.staticText2.SetBackgroundColour(wx.Colour(153, 170, 255))
self.staticText2.SetBackgroundStyle(wx.BG_STYLE_COLOUR)
self.staticText2.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD,
False, u'Tahoma'))
self.staticText1 = wx.StaticText(id=wxID_FRAME1STATICTEXT1,
label=u' Bases', name='staticText1', parent=self.panel1,
pos=wx.Point(0, 0), size=wx.Size(73, 23), style=wx.ALIGN_CENTRE)
self.staticText1.SetBackgroundColour(wx.Colour(153, 170, 255))
self.staticText1.SetBackgroundStyle(wx.BG_STYLE_COLOUR)
self.staticText1.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD,
False, u'Tahoma'))
self.button4 = wx.Button(id=wxID_FRAME1BUTTON4, label=u'Journaux',
name='button4', parent=self.panel1, pos=wx.Point(8, 40),
size=wx.Size(112, 40), style=0)
self.button4.Bind(wx.EVT_BUTTON, self.OnButton4Button,
id=wxID_FRAME1BUTTON4)
self.button5 = wx.Button(id=wxID_FRAME1BUTTON5,
label=u'Balance Comptes', name='button5', parent=self.panel1,
pos=wx.Point(8, 344), size=wx.Size(112, 40), style=0)
self.button5.Bind(wx.EVT_BUTTON, self.OnButton5Button,
id=wxID_FRAME1BUTTON5)
self.button6 = wx.Button(id=wxID_FRAME1BUTTON6,
label=u'Saisie Standard', name='button6', parent=self.panel1,
pos=wx.Point(8, 208), size=wx.Size(112, 40), style=0)
self.button6.Bind(wx.EVT_BUTTON, self.OnButton6Button,
id=wxID_FRAME1BUTTON6)
self.staticText3 = wx.StaticText(id=wxID_FRAME1STATICTEXT3,
label=u' Saisies', name='staticText3', parent=self.panel1,
pos=wx.Point(0, 168), size=wx.Size(90, 23), style=0)
self.staticText3.SetBackgroundColour(wx.Colour(153, 170, 255))
self.staticText3.SetBackgroundStyle(wx.BG_STYLE_COLOUR)
self.staticText3.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD,
False, u'Tahoma'))
self.staticText4 = wx.StaticText(id=wxID_FRAME1STATICTEXT4,
label=u' Traitements', name='staticText4', parent=self.panel1,
pos=wx.Point(0, 296), size=wx.Size(121, 23), style=0)
self.staticText4.SetBackgroundColour(wx.Colour(153, 170, 255))
self.staticText4.SetBackgroundStyle(wx.BG_STYLE_COLOUR)
self.staticText4.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD,
False, u'Tahoma'))
self.staticText5 = wx.StaticText(id=wxID_FRAME1STATICTEXT5,
label=u' Editions', name='staticText5', parent=self.panel1,
pos=wx.Point(0, 392), size=wx.Size(96, 23), style=0)
self.staticText5.SetBackgroundColour(wx.Colour(153, 170, 255))
self.staticText5.SetBackgroundStyle(wx.BG_STYLE_COLOUR)
self.staticText5.SetFont(wx.Font(14, wx.SWISS, wx.NORMAL, wx.BOLD,
False, u'Tahoma'))
def __init__(self, parent):
self._init_ctrls(parent)
def OnButton2Button(self, event):
event.Skip()
def OnButton1Button(self, event):
event.Skip()
def OnButton4Button(self, event):
fr= Frame2()
fr.Show()
even.Skip()
def OnButton5Button(self, event):
event.Skip()
def OnButton6Button(self, event):
event.Skip()
if __name__ == '__main__':
app = wx.PySimpleApp()
frame = create(None)
frame.Show()
app.MainLoop()
thanks for Help