Python WX滚动条不能显示?

写了一个关于python界面的代码,想要读取excel的数据并按关键字输出,因为输出内容比较多,所以需要滚动条,但是滚动条一直不显示,不知道怎么修改,下面是代码,请各位大神帮帮忙,谢谢!

import numpy as np
import pandas as pd
import xlrd
import xlwt
from xlutils.copy import copy
import wx
import wx.lib.scrolledpanel

class Example(wx.Frame):
def init(self):
wx.Frame.__init__(self,None,-1,'Button',size=(1500,1000))
panel1=wx.lib.scrolledpanel.ScrolledPanel(self,-1,size=(1500,1000), pos=(0,0), style=wx.SIMPLE_BORDER)
panel1.SetAutoLayout(1)
panel1.SetupScrolling()
self.userLabel=wx.StaticText(panel1,-1,"Input the name:",pos=(0,0))
self.userText=wx.TextCtrl(panel1,-1,pos=(300,0))
self.button = wx.Button(panel1,-1,"yes",pos=(500,0))
self.Bind(wx.EVT_BUTTON,self.Search,self.button)
self.button.SetDefault()

    self.label1=wx.StaticText(panel1,-1,"",pos=(300,200),style = wx.ALIGN_CENTER)

    sizer1=wx.FlexGridSizer(cols=2,hgap=50,vgap=50)
    sizer1.AddMany([self.userLabel,self.userText])
    panel1.SetSizer(sizer1)

def Search(self, event):
    content=self.userText.GetValue()
    data=xlrd.open_workbook('1.xlsx')
    table=data.sheet_by_name(u'Sheet1')
    nrows=table.nrows
    ncols=table.ncols
    table1=data.sheet_by_name(u'Sheet2')
    nrows1=table1.nrows
    ncols1=table1.ncols

    c=[]
    d=0
    for k in range(0,ncols):
        colvalue=table.col_values(k)
        if(content1==colvalue[0]):
            d=k

    for i in range(0,nrows):
        rowvalue=table.row_values(i)
        if(content in rowvalue[2]):
            c.append('A: '+rowvalue[1]+'\n'+'B: '+ str(rowvalue[3]))

    b='\n'.join(c)

    self.label1.SetLabel(b)

ex = wx.App()
frame=Example()
frame.Show()
ex.MainLoop()

Csdn user default icon
上传中...
上传图片
插入图片
抄袭、复制答案,以达到刷声望分或其他目的的行为,在CSDN问答是严格禁止的,一经发现立刻封号。是时候展现真正的技术了!