Can someone please fill in the missing line of code in OnPageChange? I have a notebook control and on a page change event, I want to retrieve the label of the tab that was just selected. GetLabel and GetLabelText both return ''
import wx
import wx.lib.mixins.inspection
class Frame(wx.Frame):
def __init__(self,parent=None):
wx.Frame.__init__(self, None, -1, "test notebook",size=(300,300))
self.Bind(wx.EVT_CLOSE,self.OnExit,self)
self.CreateStatusBar()
self.nb = wx.Notebook(self)
self.nb.Bind(wx.EVT_NOTEBOOK_PAGE_CHANGED,self.OnPageChange)
for page in ("page 1","page 2","page 3"):
panel = wx.Panel(self.nb)
self.nb.AddPage(panel,page)
def OnPageChange(self,event):
#current = event.EventObject.?
self.SetStatusText("current page is ...")
def OnExit(self,event):
self.Destroy()
class MyApp(wx.App, wx.lib.mixins.inspection.InspectionMixin):
def OnInit(self):
self.Init() # initialize the inspection tool
frame = Frame(None)
frame.Show()
self.SetTopWindow(frame)
return True
app = MyApp(redirect=False)
app.MainLoop()