Вы можете bind
для события wx.aui.EVT_AUINOTEBOOK_END_DRAG
и установить там переменную.
import wx
import wx.aui
class Frame1 (wx.Frame):
def __init__(self,parent):
wx.Frame.__init__ (self,parent,id=wx.ID_ANY,title="Aui Notebook",size=(500,300))
self.tabs_altered = False
bSizer1 = wx.BoxSizer( wx.VERTICAL )
self.m_auinotebook1 = wx.aui.AuiNotebook( self, wx.ID_ANY)
self.m_panel2 = wx.Panel( self.m_auinotebook1, wx.ID_ANY, style=wx.TAB_TRAVERSAL )
self.p2_text = wx.StaticText(self.m_panel2, -1, "1 has not been moved", pos=(10,10))
self.m_auinotebook1.AddPage( self.m_panel2, u"page1", True, wx.NullBitmap )
self.m_panel3 = wx.Panel( self.m_auinotebook1, wx.ID_ANY, style=wx.TAB_TRAVERSAL )
self.p3_text = wx.StaticText(self.m_panel3, -1, "2 has not been moved", pos=(10,10))
self.m_auinotebook1.AddPage( self.m_panel3, u"page2", False, wx.NullBitmap )
self.m_panel4 = wx.Panel( self.m_auinotebook1, wx.ID_ANY, style=wx.TAB_TRAVERSAL )
self.p4_text = wx.StaticText(self.m_panel4, -1, "3 has not been moved", pos=(10,10))
self.m_auinotebook1.AddPage( self.m_panel4, u"page3", False, wx.NullBitmap )
bSizer1.Add( self.m_auinotebook1, 1, wx.EXPAND |wx.ALL, 5 )
self.SetSizer( bSizer1 )
self.Layout()
self.Centre( wx.BOTH )
# Connect Event
self.m_auinotebook1.Bind(wx.aui.EVT_AUINOTEBOOK_END_DRAG, self.OnAuiDragend)
def OnAuiDragend(self,event):
page_idx = event.GetSelection()
text = self.m_auinotebook1.GetPageText(page_idx)
if text == "page1":
self.p2_text.SetLabel("1 Moved")
if text == "page2":
self.p3_text.SetLabel("2 Moved")
if text == "page3":
self.p4_text.SetLabel("3 Moved")
self.tabs_altered = True
if __name__ == "__main__":
app = wx.App()
frame = Frame1(None)
frame.Show()
app.MainLoop()