Drawing a wx.grid.Grid without scrollbars

1,370 views
Skip to first unread message

David Hughes

unread,
Jul 29, 2019, 11:06:04 AM7/29/19
to wxPython-users
I am drawing a grid, together with other widgets, in a panel of a tabbed notebook. I am using wx.DefaultSize and putting it in an expandable BoxSizer.

If I create the grid while that tabbed panel is being displayed, it always adds horizontal and vertical scrollbars although the overall size of the grid is sufficient to contain the whole grid if the scrollbars weren't being drawn. In fact if I visit a different page on the notrebook and tab back again, the grid is correctly displayed without the scrollbars.

Is there any way to create the grid while that page is visible but without the scrollbars? I've tried various combinations of CallAfter / notebook panel / Refresh() but without success.
--
Regards

David Hughes

Andrea Gavana

unread,
Jul 29, 2019, 11:10:21 AM7/29/19
to wxpytho...@googlegroups.com
Hi David,

Did you try to force a resize of your main notebook/frame? Just a shot in the dark, but sometimes for me it works if I call SendSizeEvent on the top container window or, when everything else fails, I brutally do something like this:

size = self.GetSize()
self.SetSize(wx.Size(size[0]+1, size[1]))
self.SetSize(size)

On the top window container - maybe with Freeze() and Thaw() in between.

Andrea.


--
Regards

David Hughes

--
You received this message because you are subscribed to the Google Groups "wxPython-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to wxpython-user...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/wxpython-users/1082534f-329c-4366-9c6b-1333253b7af5%40googlegroups.com.

David Hughes

unread,
Jul 30, 2019, 5:33:24 AM7/30/19
to wxpytho...@googlegroups.com
On 29/07/2019 16:10, Andrea Gavana wrote:
> Did you try to force a resize of your main notebook/frame? Just a shot
> in the dark, but sometimes for me it works if I call SendSizeEvent on
> the top container window . . .

Yes:

        <panel>.SendSizeEvent(wx.SEND_EVENT_POST)

works, as does the more readable equivalent of calling the function with
this flag:

        <grid>.PostSizeEventToParent()

Thanks!

--
Regards

David Hughes
Forestfield Software


steve

unread,
Aug 1, 2019, 5:52:51 PM8/1/19
to wxPython-users
Hi David,

Try this:

Hide vertical and horizontal scroll bars:

grid_object.ShowScrollbars(wx.SHOW_SB_NEVER,wx.SHOW_SB_NEVER)

Reply all
Reply to author
Forward
0 new messages