文章详情

  • 游戏榜单
  • 软件榜单
关闭导航
热搜榜
热门下载
热门标签
php爱好者> php文档>Frames and Dialogs → AUI_MDI

Frames and Dialogs → AUI_MDI

时间:2007-04-12  来源:wxPhoenix

overview = """\
The wx.aui.AuiMDIParentFrame and wx.aui.AuiMDIChildFrame classes
implement the same API as wx.MDIParentFrame and wx.MDIChildFrame, but
implement the multiple document interface with a wx.aui.AuiNotebook.

"""
  import wx
import wx.aui
    class MDIParentFrame(wx.aui.AuiMDIParentFrame):           
 def __init__(self, parent):
  wx.aui.AuiMDIParentFrame.__init__(self, parent, -1,
            title="Test AuiMDIParentFrame",
            size=(640, 480),
            style=wx.DEFAULT_FRAME_STYLE)
           
  # Total count of child frames that have been newed
  self.CountOfChildFrame = 0 
  MenuBar = self.MakeMenuBar()
  self.SetMenuBar(MenuBar)
  self.CreateStatusBar()
  

 def MakeMenuBar(self):
  MenuBar = wx.MenuBar()
  
  FileMenu = wx.Menu()
  MenuItem = FileMenu.Append(-1, "New Child Window\tCtrl-N")
  self.Bind(wx.EVT_MENU, self.OnNewChildWindow, MenuItem)
  MenuItem = FileMenu.Append(-1, "Close Parent")
  self.Bind(wx.EVT_MENU, self.OnClose, MenuItem)
  
  MenuBar.Append(FileMenu, "&File")
  
  return MenuBar
  

 def OnNewChildWindow(self, event):
  self.CountOfChildFrame += 1
  ChildFrame = MDIChildFrame(self, self.CountOfChildFrame)
  ChildFrame.Show(True)
  
 def OnClose(self, event):
  self.Close(True)
  
  
class MDIChildFrame(wx.aui.AuiMDIChildFrame):
 def __init__(self, parent, index):
  wx.aui.AuiMDIChildFrame.__init__(self, parent, -1,
           title="Child %d" % index)
    
  # Childs can custom their own menubar      
  MenuBar = parent.MakeMenuBar()
  ChildMenu = wx.Menu()
  MenuItem = ChildMenu.Append(-1, "This is child %d's menu" % index)
  MenuBar.Append(ChildMenu, "&Child")
  self.SetMenuBar(MenuBar)
  
  Panel = wx.Panel(self)
  wx.StaticText(Panel, -1, "This is child %d " % index, (10, 10))
  Panel.SetBackgroundColour("light blue")
  
  Sizer = wx.BoxSizer()
  Sizer.Add(Panel, 1, wx.EXPAND)
  self.SetSizer(Sizer)
  
  wx.CallAfter(self.Layout)
  
  
def TestMDIParentFrame():
 TheApp = wx.PySimpleApp()
 ParentFrame = MDIParentFrame(None)
 ParentFrame.Centre()
 ParentFrame.Show()
 TheApp.MainLoop()
  

if __name__ == "__main__":
 TestMDIParentFrame()
相关阅读 更多 +
排行榜 更多 +
辰域智控app

辰域智控app

系统工具 下载
网医联盟app

网医联盟app

运动健身 下载
汇丰汇选App

汇丰汇选App

金融理财 下载