wxPython、MainWindow、およびRecWindowを使用して作成された独自のフレームを持つ2つのpyファイルがあります。MainWindow には、キーワード「recovery」を使用して含まれる RecWindow python ファイルがあります。
メインウィンドウ コード:
class MainWindow(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self, parent, wx.ID_ANY,title,pos=(500,200), size = (650,500), style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
self.Bind(wx.EVT_CLOSE,self.OnExit)
self.SetIcon(wx.Icon('etc\icons\download.ico', wx.BITMAP_TYPE_ICO))
panel = wx.Panel(self)
RecWindow コード:
class RecWindow(wx.Frame):
def __init__(self,parent,id,title):
wx.Frame.__init__(self, parent, wx.ID_ANY,title,pos=(400,200), size = (700,600), style = wx.DEFAULT_FRAME_STYLE | wx.NO_FULL_REPAINT_ON_RESIZE)
self.SetIcon(wx.Icon('etc\icons\download.ico', wx.BITMAP_TYPE_ICO))
self.count = 0
MainWindow のボタンをクリックすると、 MainWindow が非表示になり、以下に示すように RecWindow のインスタンスが作成されます。
def OpenRec(self,event):#this will be used to open the next frame
OR = recovery(None,-1,"RAVE")
OR.Show(True)
MainWindow.Hide()
今、私が確信していないのは、RecWindow を閉じたら MainWindow に戻る方法です。RecWindow にはキャンセル ボタンと終了ボタンがあり、どちらも self.close() 関数にマップされます。MainWindow を再び表示するにはどうすればよいでしょうか。