I had asked a similar question here, but this one is slightly different.
I have a frame and a grid on it. Although I use wx.EXPAND flag and SetSizerAndFit and Layout methods, the frame doesn’t display the grid columns completely. There appears a horizontal scroll bar on the grid, and user has to scroll to right to display all grid columns.
Why does the system behave this way at start up? How to solve it?
You specified wx.EXPAND flag to the horizontal grid_sizer, thus it expands vertically, but with proportion=0 the control does not fill the client area horizontally. First, you need to modify:
Thank you for your reply. Setting proportion=0 didn’t work. The frame still doesn’t display all grid columns completely.
Why do I have to tell the scroll bar width explicitly to the application in the start up? I’m using wx.EXPAND flag and proportion=1 parameter and self.Layout() method. It should have taken care of everything automatically by itself. I think this is a bug, @Robin for your information.
I don’t think it is a bug, just a design.
For example, suppose you have a small number of data rows, such as 10 or 20. Replace your code with:
for i in range(10):
self.grid.AppendRows(1)
Then, I guess the resulting layout would be what you expected.
If you replace it with range(1000) that is too large to show at once, the frame fits its height to the desktop and a vertical scrollbar will appear but the width of the frame won’t change. As a result, a horizontal scrollbar appears.
So, the width is not being automatically adjusted to not show the horizontal scrollbar, and it is not preferable for you, and if you think it’s a bug, then yes, it is a bug, in your code.
well @steve2, I think what @komoto48g said is quite plausible because every designer has to take a choice
if you don’t like that choice then, I’m afraid, you’ll have to find a way to implement your idea on top of that choice and, luckily, wxPython offers a lot to make your own ideas come true (I think )