[wxpython-users] Adding pages to FlatNotebook
Andrea Gavana
andrea.gavana at gmail.com
Thu May 22 06:51:52 PDT 2008
Hi Jurgen,
On Wed, May 21, 2008 at 11:18 PM, "Jürgen Waser" wrote:
> Thanks for the quick help!
>
> Methods "IsTabVisible" and "RotateRight" are not part of the FlatNotebook but of the associated PageContainer. So I changed the code to (accessing private variable, not so pretty):
>
> def MakeTabVisible(self, pageNum):
>
> if self._pages.IsTabVisible(pageNum):
> return
>
> # If you want to make visible the rightmost tab
> self._pages.RotateRight()
>
> Unfortunately the code has no affect on the behaviour.
Try the following:
1) Add to FlatNotebook source code the following method:
def EnsureVisible(self, page):
""" Ensures that a tab is visible. """
self._pages.DoSetSelection(page)
2) Insert this function in your script and call it every time you add
a new page and you want it visible:
def MakeTabVisible(self, pageNum):
# If you want to make visible the rightmost tab
self.EnsureVisible(pageNum)
Where "self" now is really a FlatNotebook :-D . This should really go
in SVN, but I am not sure if the default behavior when adding pages to
a notebook should be to make their tabs visible if they are selected.
If this is the case, I'll go and update wxPython SVN with these
modifications.
Andrea.
"Imagination Is The Only Weapon In The War Against Reality."
http://xoomer.alice.it/infinity77/
More information about the wxpython-users
mailing list