我正在试图弄清楚如何在滚动的面板框中更改文本但由于某种原因它会给我这个错误。
File "/Users/adapterad/Desktop/daba-0/gdisamb.pyw", line 1089, in ShowSent
self.Sizer.Remove(self.annotlist)
TypeError: Sizer.Remove(): arguments did not match any overloaded call:
overload 1: argument 1 has unexpected type 'ScrolledPanel'
这是代码:
def CreateGlossButtons(self) :
self.annotlist = wx.lib.scrolledpanel.ScrolledPanel(self, wx.ID_ANY)
self.annotlist.SetScrollRate(20, 20)
if self.vertical:
annotsizer = wx.BoxSizer(wx.HORIZONTAL)
else:
annotsizer = wx.BoxSizer(wx.VERTICAL)
for (toknum, (token,selectlist)) in enumerate(zip(self.tokenlist,self.selectlist)):
abox = GlossSelector(self.annotlist, (self.snum, toknum), token, selectlist, vertical=self.vertical)
tokenbuttons.append(abox)
annotsizer.Add(abox)
self.annotlist.SetSizer(annotsizer)
self.annotlist.Layout()
return tokenbuttons
def ShowSent(self, senttuple, snum):
self.senttext, self.selectlist, self.tokenlist, self.sentindex = senttuple
self.senttext = self.senttext.strip()
if self.isshown:
self.sentsource.ClearSentence()
self.Sizer.Remove(self.annotlist)
self.annotlist.Destroy()
self.snum = snum
self.sentnumbutton.SetValue(snum+1)
tokenbuttons = self.CreateGlossButtons()
self.sentsource.SetSentence(self.senttext, tokenbuttons)
self.Sizer.Add(self.annotlist, 1, wx.EXPAND)
self.Layout()
self.isshown = True`