Hi,
How can I close a one frame and instantiate another frame in same function? For example In function OnOk, I am calling Frame2 class.but I want to close Frame1.
class Frame1(wx.Frame):
def init(self, parent, id, title = “Frame3”):
wx.Frame.init(self, parent,-1,title,wx.DefaultPosition,wx.Size(300,150))
self.SetIcon(wx.Icon(‘PyCrust.ico’,wx.BITMAP_TYPE_ICO))
self.mainpa = wx.Panel(self,-1,wx.DefaultPosition, wx.DefaultSize)
Ok = wx.Button(self.mainpa, -1, 'Ok',wx.Point(50,50))
self.Bind(wx.EVT_BUTTON,self.OnOk,Ok)
def OnOk(self,event):
self.dlg1 = Frame2(self, -1)
self.dlg1.Show(True)
class Frame2(wx.Frame):
def init(self, parent, id, title = “Frame2”):
wx.Frame.init(self, parent,-1,title,wx.DefaultPosition,wx.Size(300,150))
self.SetIcon(wx.Icon(‘PyCrust.ico’,wx.BITMAP_TYPE_ICO))
self.mainpa = wx.Panel(self,-1,wx.DefaultPosition, wx.DefaultSize)
Thanks
Prasoona