How to size Notebook so that all tabs are shown

Hi all

There may not be an answer to this, but I am hoping that Robin will come up
with one of his inspired solutions :slight_smile:

I have a wx.Frame with a panel with various controls, and the panel has a
sizer. One of the controls is a wx.Notebook, where each page contains a
panel with various controls, and each panel has its own sizer. After adding
all the controls I call self.frame.SetClientSize(self.panel.GetBestSize()).
The Notebook is sized according to the size of its largest page, and it all
works fine.

I now have a situation where the Notebook has, say, 5 pages, none of which
are particularly wide, so the overall width given to the Notebook is quite
small. This results in there not being enough width to show all the tabs, so
a 'tab scroll bar' appears. There is plenty of space to show all the tabs,
so I want to tell it to make the Notebook wider.

I can call SetSizeHints(500,-1) on the Notebook, and it correctly sets the
width to 500, with all tabs visible. The question is, how can I get the size
of the tabs so that I can calculate the desired width? I can call
GetTextExtent() on each GetPageText(), but this ignores the padding. There
is a SetPadding() method, but no GetPadding().

Does anyone have any suggestions?

Thanks

Frank Millman

Frank Millman wrote:

Hi all

There may not be an answer to this, but I am hoping that Robin will come up
with one of his inspired solutions :slight_smile:

No luck this time. The only thing I can think of is to measure the text and make a platform specific guess on how much padding is needed per item.

···

--
Robin Dunn
Software Craftsman
http://wxPython.org Java give you jitters? Relax with wxPython!