[wxPython-users] Binding an AuiNotebookEvent?
Christoph Becker
cgbecker at gmx.de
Mon Feb 5 08:01:35 PST 2007
I modified the wxpython demo file AUI_MID.py
The following works:
class ParentFrame(wx.aui.AuiMDIParentFrame):
def __init__(self, parent):
wx.aui.AuiMDIParentFrame.__init__(self, parent, -1,
title="AuiMDIParentFrame",
size=(640,480),
style=wx.DEFAULT_FRAME_STYLE |
wx.FRAME_NO_WINDOW_MENU )
# switch off the default Window-Menu-Entry
.....
self.nb = self.GetNotebook()
# Following works
self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGING,self.OnNotebookPageChanging)
# This does NOTHING (a bug?):
self.Bind(wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED,self.OnNotebookPageChanged)
def OnNotebookPageChanging(self,event):
a = self.nb.GetSelection()
print "page changing, selected: " + `a` # the old selection
# now call self.OnNotebookPageChanged, since
wx.aui.EVT_AUINOTEBOOK_PAGE_CHANGED
# does not work:
wx.CallAfter(self.OnNotebookPageChanged)
def OnNotebookPageChanged(self,event=None):
a = self.nb.GetSelection()
print "page changed, selected: " + `a` # the new selection
print '-------------------'
> How do I find the event id like wx.EVT_XXX to bind
> and where can I look in the future so that I can figure out these
> kinds of things myself?
Here you did not need an event id.
Having imported wx.aui, I tried the following in wingide (see
www.wingware.com)
wx.aui.AuiNotebook.
and
wx.aui.EVT_
The editor did show lists with possible completions, while in the
sourceassistant-window there was more information on the details of the
possible selections.
The book 'wxPython in action', from Noel Rappin and Robin Dunn, may be
very help full too. I did learn much from it when I read it recently,
although I use wxPython for almost 4 years now.
Christoph Becker
Rooney, Mike (ext. 324) schrieb:
> Looking in the docs of an AuiNotebook I don't see a list of events
> that can be bound, however searching online shows a
> wx.aui.AuiNotebookEvent existing, which has a GetSelection
> and GetOldSelection, which is exactly what I want to get from
> the event. How do I find the event id like wx.EVT_XXX to bind
> and where can I look in the future so that I can figure out these
> kinds of things myself?
>
> Thanks,
> Mike
>
> ---------------------------------------------------------------------
> To unsubscribe, e-mail: wxPython-users-unsubscribe at lists.wxwidgets.org
> For additional commands, e-mail: wxPython-users-help at lists.wxwidgets.org
>
>
More information about the wxpython-users
mailing list