In this question I got help with the wxPython ScrolledPanel panel, which really helped, but I have noticed that the scrollbar is interfering/overlapping with the buttons I am creating. Is there a way to get this to stop?
Code:
class ScrollyPanel(wxScrolledPanel.ScrolledPanel):
def __init__(self, parent):
wxScrolledPanel.ScrolledPanel.__init__(self, parent, style=wx.VSCROLL,
size=(200,200))
self.__sizer = wx.WrapSizer()
self.SetupScrolling(scroll_x = False, scroll_y = True)
self.addButton(200)
self.SetSizer(self.__sizer)
self.Bind(wx.EVT_SIZE, self.onSize)
self.SetAutoLayout(True)
self.Layout()
def addButton(self, num):
size = wx.Size(200, 100)
for i in range(1, num):
btn = wx.Button(self, wx.ID_ANY, "btn"+str(i), size = size,
style = wx.BORDER_SIMPLE)
self.__sizer.Add(btn, 0, wx.ALL, 2)
def onSize(self, evt):
size = self.GetSize()
vsize = self.GetVirtualSize()
self.SetVirtualSize((size[0], vsize[1]))
evt.Skip()
Is there a way to add padding so the scrollbars aren't overlapping the buttons?
Thank you
xxx