I’m having trouble with the layout of a wx.Notebook holding a page with a wx.ScrolledWindow and have attached a couple of small sample apps to illustrate this.
scrtest_app1 illustrates the behaviour I would like but does not include a wx.Notebook. It has a wx.Panel beneath which is a wx.ScrolledWindow (which only scrolls horizontally) holding a row of buttons. If the user changes the width of the Frame, the height of the ScrolledPanel is adjusted by the auto-layout according to whether or not the horizontal scrollbar is showing.
scrtest_app2 has the wx.ScrolledWindow within a wx.Notebook but is otherwise the same. When the user changes the width of the Frame, however, the height of the Notebook is not adjusted and part of the button panel is covered by the horizontal scrollbar.
I’m guessing that I somehow need to tell the wx.Notebook to recalculate its best size, but I’ve not had any success so far. If anyone knows how to do this I’d really appreciate it. (I need the wx.Notebook because in the real world there are more pages.)
I’ve tried the sample apps with Python 2.7.3 32-bit, wxPython 2.8.12.1 (msw-unicode) on Windows 7 and python 2.7.3 64-bit, wxPython 2.8.12.1 (gtk2-unicode) on Centos5 with similar results.
Thanks.
scrtest_app1.py (1001 Bytes)
scrtest_app2.py (1.08 KB)
Hi Werner,
Thanks for the quick reply. That works for me on Linux as for you. The whole button panel is taller, so I think the border adjustment happens when the buttons are repositioned according to the wx.ALIGN_CENTRE flag. This wouldn’t be a problem, but unfortunately FitInside() seems to have no effect for me on Windows.
···
On Tuesday, 22 July 2014 14:01:40 UTC+1, werner wrote:
Hi Jill,
On 7/22/2014 14:36, Jill Holliday wrote:
I’m having trouble with the layout of a wx.Notebook holding a page
with a wx.ScrolledWindow and have attached a couple of small sample
apps to illustrate this.
scrtest_app1 illustrates the behaviour I would like but does not
include a wx.Notebook. It has a wx.Panel beneath which is a
wx.ScrolledWindow (which only scrolls horizontally) holding a row of
buttons. If the user changes the width of the Frame, the height of
the ScrolledPanel is adjusted by the auto-layout according to whether
or not the horizontal scrollbar is showing.
scrtest_app2 has the wx.ScrolledWindow within a wx.Notebook but is
otherwise the same. When the user changes the width of the Frame,
however, the height of the Notebook is not adjusted and part of the
button panel is covered by the horizontal scrollbar.
I’m guessing that I somehow need to tell the wx.Notebook to
recalculate its best size, but I’ve not had any success so far. If
anyone knows how to do this I’d really appreciate it. (I need the
wx.Notebook because in the real world there are more pages.)
I’ve tried the sample apps with Python 2.7.3 32-bit, wxPython 2.8.12.1
(msw-unicode) on Windows 7 and python 2.7.3 64-bit, wxPython 2.8.12.1
(gtk2-unicode) on Centos5 with similar results.
Adding “p2.FitInside()” after “p2.SetSizer(hsizer)” does it mostly, for
some reason the border around the button is adjusted when you resize the
frame, can’t figure that one out.
Werner
Hi Jill,
...
Hi Werner,
Thanks for the quick reply. That works for me on Linux as for you. The whole button panel is taller, so I think the border adjustment happens when the buttons are repositioned according to the wx.ALIGN_CENTRE flag. This wouldn't be a problem, but unfortunately FitInside() seems to have no effect for me on Windows.
Hhm, strange as I am on Windows 8.1, Python 2.7.8, first tested on Phoenix but just tried with 2.8.12.1 (msw-unicode) and it works for me on both versions.
Werner
···
On 7/22/2014 16:13, Jill Holliday wrote:
Thanks Werner, maybe I have something else odd on Windows. I’ll do some more investigating.
Jill
···
On Tuesday, 22 July 2014 15:42:05 UTC+1, werner wrote:
Hi Jill,
On 7/22/2014 16:13, Jill Holliday wrote:
…
Hi Werner,
Thanks for the quick reply. That works for me on Linux as for you.
The whole button panel is taller, so I think the border adjustment
happens when the buttons are repositioned according to the
wx.ALIGN_CENTRE flag. This wouldn’t be a problem, but unfortunately
FitInside() seems to have no effect for me on Windows.
Hhm, strange as I am on Windows 8.1, Python 2.7.8, first tested on
Phoenix but just tried with 2.8.12.1 (msw-unicode) and it works for me
on both versions.
Werner
OK, I’ve tried various combinations and must have a problem on the first Windows machine. Your solution works fine on Python 2.7.3, wxPython 2.8.12.1 (msw-unicode), Windows server 2008 (both 32-bit and 64-bit builds) and Python 2.7.1, wxPython 2.8.11.0 (msw-unicode), Windows 7 Starter. So I think that’s a separate issue, but thanks very much for the help with the original problem.
Jill
···
On Tuesday, 22 July 2014 15:46:02 UTC+1, Jill Holliday wrote:
On Tuesday, 22 July 2014 15:42:05 UTC+1, werner wrote:
Hi Jill,
On 7/22/2014 16:13, Jill Holliday wrote:
…
Hi Werner,
Thanks for the quick reply. That works for me on Linux as for you.
The whole button panel is taller, so I think the border adjustment
happens when the buttons are repositioned according to the
wx.ALIGN_CENTRE flag. This wouldn’t be a problem, but unfortunately
FitInside() seems to have no effect for me on Windows.
Hhm, strange as I am on Windows 8.1, Python 2.7.8, first tested on
Phoenix but just tried with 2.8.12.1 (msw-unicode) and it works for me
on both versions.
Werner
Thanks Werner, maybe I have something else odd on Windows. I’ll do some more investigating.
Jill
Just to add to that (and putting aside the issue of the “rogue” Windows machine), adding FitInside() still didn’t fix my problem on Windows although it did on Linux. A bit more investigation showed that this related to an additional border style set on the wx.ScrolledWindow. I did a few tests on the “non-rogue” Windows machines - adding FitInside() had the desired effect when no additional style was set or for WX.BORDER_SIMPLE, BORDER_STATIC or BORDER_NONE but not with wx.BORDER_SUNKEN, BORDER_RAISED OR BORDER_DOUBLE. This is fine for me now I know, as I don’t really need the extra style, but I just wanted to add it to the posts for info.
Jill
···
On Tuesday, 22 July 2014 16:50:25 UTC+1, Jill Holliday wrote:
On Tuesday, 22 July 2014 15:46:02 UTC+1, Jill Holliday wrote:
On Tuesday, 22 July 2014 15:42:05 UTC+1, werner wrote:
Hi Jill,
On 7/22/2014 16:13, Jill Holliday wrote:
…
Hi Werner,
Thanks for the quick reply. That works for me on Linux as for you.
The whole button panel is taller, so I think the border adjustment
happens when the buttons are repositioned according to the
wx.ALIGN_CENTRE flag. This wouldn’t be a problem, but unfortunately
FitInside() seems to have no effect for me on Windows.
Hhm, strange as I am on Windows 8.1, Python 2.7.8, first tested on
Phoenix but just tried with 2.8.12.1 (msw-unicode) and it works for me
on both versions.
Werner
Thanks Werner, maybe I have something else odd on Windows. I’ll do some more investigating.
Jill
OK, I’ve tried various combinations and must have a problem on the first Windows machine. Your solution works fine on Python 2.7.3, wxPython 2.8.12.1 (msw-unicode), Windows server 2008 (both 32-bit and 64-bit builds) and Python 2.7.1, wxPython 2.8.11.0 (msw-unicode), Windows 7 Starter. So I think that’s a separate issue, but thanks very much for the help with the original problem.
Jill