I have tried to follow question and answer from this site regarding making a scrolly window with bitmaps, but I can't get it behave how I expected it to.
This is the panel 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)
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(100, 100)
for i in range(1, num):
btn = wx.Button(self, wx.ID_ANY, "btn"+str(i), size = size)
self.__sizer.Add(btn, 0, wx.ALL)
def onSize(self, evt):
size = self.GetSize()
vsize = self.GetVirtualSize()
self.SetVirtualSize((size[0], vsize[1]))
evt.Skip()
I was expected closely aligned bitmaps of 100 x 100, but I am getting largely space bitmaps that aren't equally spaced.
Here is a screenshot of what I am seeing. I am totally confused as I cannot see any borders.
I am using wxPython 3 on Python 2.7.10