如何在子框架打开时使顶部框架无法访问?
import wx
class MyFrame(wx.Frame):
def __init__(self, parent, title):
wx.Frame.__init__(self, parent, title=title, size=(400, 320), style=(wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN))
# Setting up menu
filemenu = wx.Menu()
set_m = filemenu.Append(wx.ID_PREFERENCES, 'Settings', 'Settings')
# filemenu.Append(US)
filemenu.AppendSeparator()
exit_m = filemenu.Append(wx.ID_EXIT)
# Creating the menubar
menubar = wx.MenuBar()
menubar.Append(filemenu, 'Menu')
self.SetMenuBar(menubar)
self.Bind(wx.EVT_MENU, self.OnSettings, set_m)
def OnSettings(self, e):
SetFrame().Show()
class SetFrame(wx.Frame):
title = 'Settings'
def __init__(self):
wx.Frame.__init__(self, wx.GetApp().TopWindow, title=self.title, size=(400, 250), style=(wx.MINIMIZE_BOX | wx.SYSTEM_MENU | wx.CAPTION | wx.CLOSE_BOX | wx.CLIP_CHILDREN))
class MyApp (wx.App):
def OnInit(self):
self.frame = MyFrame(None, title='Parent-Frame')
self.frame.Show()
self.SetTopWindow(self.frame)
return True
if __name__ == '__main__':
app = MyApp(0)
app.MainLoop()