wxPython:wx.lib.scrolledpanel.ScrolledPanel滚动条重叠按钮

时间:2017-12-06 18:48:15

标签: python python-2.7 layout wxpython wxwidgets

this问题中,我得到了wxPython ScrolledPanel面板的帮助,这确实有帮助,但我注意到滚动条与我正在创建的按钮发生干扰/重叠。有没有办法让它停止?

代码:

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()

我看到的问题: enter image description here

有没有办法添加填充以使滚动条不与按钮重叠?

谢谢

XXX

0 个答案:

没有答案