[wxPython-users] AUI Notebook question
Frank Niessink
frank at niessink.com
Fri Dec 14 11:53:17 PST 2007
Hi Lexy-lou,
2007/12/14, lexy-lou at doyenne.com <lexy-lou at doyenne.com>:
>
> Hi,
>
> I have an AUI Notebook (whee! :). Each tab essentially shows a different
> facet of a selected object in the user's library. I thought it would be
> Rilly Cool(tm) if I could bind the left and right arrows to move
> sequentially through the tabs.
The regular wx.Notebook class has a method AdvanceSelection, but
unfortunately AUINotebook does not. Here's my implementation of it:
class MyAuiNotebook(wx.aui.AuiNotebook):
def AdvanceSelection(self, forward=True):
''' This method is part of the Notebook API but missing from the
AuiNotebook API. '''
if self.PageCount <= 1:
return # Not enough viewers to advance selection
if forward:
if 0 <= self.Selection < self.PageCount - 1:
self.Selection += 1
else:
self.Selection = 0
else:
if 1 <= self.Selection < self.PageCount:
self.Selection -= 1
else:
self.Selection = self.PageCount - 1
Next bind the keys you want to this method, for example by using two
menu items with keyboard shortcuts (one for moving forward and one for
backward).
Cheers, Frank
More information about the wxpython-users
mailing list