当我关闭auinotebook中的标签时会使用什么事件?我用EVT_AUINOTEBOOK_PAGE_CLOSE(D)进行了测试.它没用.
我还要右键单击选项卡本身事件.
我在哪里可以找到可以与aui manager/notebook一起使用的所有事件?可能只是我糟糕的搜索技能,但我找不到存在的不同事件的任何列表,也不能找到鼠标/窗口事件.拥有一份完整的清单真的很方便.
#!/usr/bin/python #12_aui_notebook1.py import wx import wx.lib.inspection class MyFrame(wx.Frame): def __init__(self, *args, **kwds): wx.Frame.__init__(self, *args, **kwds) self.nb = wx.aui.AuiNotebook(self) self.new_panel('Page 1') self.new_panel('Page 2') self.new_panel('Page 3') self.nb.Bind(wx.EVT_AUINOTEBOOK_PAGE_CLOSED, self.close) def new_panel(self, nm): pnl = wx.Panel(self) pnl.identifierTag = nm self.nb.AddPage(pnl, nm) self.sizer = wx.BoxSizer() self.sizer.Add(self.nb, 1, wx.EXPAND) self.SetSizer(self.sizer) def close(self, event): print 'closed' class MyApp(wx.App): def OnInit(self): frame = MyFrame(None, -1, '12_aui_notebook1.py') frame.Show() self.SetTopWindow(frame) return 1 if __name__ == "__main__": app = MyApp(0) # wx.lib.inspection.InspectionTool().Show() app.MainLoop()
Oerjan Pettersen
这是您想要的绑定命令:
self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CLOSED, self.close, self.nb)
要检测选项卡上的右键单击(例如,显示自定义上下文菜单):
self.Bind(wx.aui.EVT_AUINOTEBOOK_TAB_RIGHT_DOWN, self.right, self.nb)
这是aui笔记本事件的列表:
EVT_AUINOTEBOOK_PAGE_CLOSE EVT_AUINOTEBOOK_PAGE_CLOSED EVT_AUINOTEBOOK_PAGE_CHANGED EVT_AUINOTEBOOK_PAGE_CHANGING EVT_AUINOTEBOOK_BUTTON EVT_AUINOTEBOOK_BEGIN_DRAG EVT_AUINOTEBOOK_END_DRAG EVT_AUINOTEBOOK_DRAG_MOTION EVT_AUINOTEBOOK_ALLOW_DND EVT_AUINOTEBOOK_DRAG_DONE EVT_AUINOTEBOOK_BG_DCLICK EVT_AUINOTEBOOK_TAB_MIDDLE_DOWN EVT_AUINOTEBOOK_TAB_MIDDLE_UP EVT_AUINOTEBOOK_TAB_RIGHT_DOWN EVT_AUINOTEBOOK_TAB_RIGHT_UP
来自:{python folder}/Lib/site-packages/{wxpython folder} /wx/aui.py