如何解决Sizer.Remove(): 参数不匹配任何重载调用
有谁知道我如何修复以下错误:
self.vbSizers[turnNum].Remove(self.locations[turnNum])
builtins.TypeError: Sizer.Remove(): 参数不匹配任何重载调用:
重载 1:参数 1 具有意外类型“TextPanel”
重载 2:参数 1 具有意外类型“TextPanel”
“ADD”命令有效:
self.vbSizers[turnNum].Add(self.locations[turnNum],1,wx.EXPAND|wx.CENTRE)
那么为什么“删除”命令不起作用?这是源代码的链接:
https://github.com/horald/londonlaw/blob/master/londonlaw/guiclient/HistoryWindow.py 在第 104 行
非常感谢。
解决方法
BoxSizer 上的 Remove
函数需要一个索引作为输入。
Remove(...)
Remove(sizer) -> bool
Remove(index) -> bool
Removes a sizer child from the sizer and destroys it.
,
谢谢,但我如何找到索引?
我已经按照如下方式更改了源代码,但是当我尝试删除它时,出现了一个新错误。
if self.vbSizers[turnNum].IsEmpty() == False:
print(self.vbSizers[turnNum].GetItemCount())
self.vbSizers[turnNum].Remove(self.vbSizers[turnNum].GetItemCount())
wx._core.wxAssertionError: C++ assertion "index >= 0 && (size_t)index < m_children.GetCount()" failed at ../src/common/sizer.cpp(709) in Remove(): Remove index is out of range
版权声明:本文内容由互联网用户自发贡献,该文观点与技术仅代表作者本人。本站仅提供信息存储空间服务,不拥有所有权,不承担相关法律责任。如发现本站有涉嫌侵权/违法违规的内容, 请发送邮件至 dio@foxmail.com 举报,一经查实,本站将立刻删除。