Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/291.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
can';t在wxPython虚拟网格中添加列_Python_Wxpython - Fatal编程技术网

can';t在wxPython虚拟网格中添加列

can';t在wxPython虚拟网格中添加列,python,wxpython,Python,Wxpython,我有一个wxPython GUI,有一个非常大的网格。我使用的代码与wxPython演示中的示例类似,即使用PyGridTableBase创建虚拟网格 然而,当我尝试以交互方式将列添加到此网格时,我遇到了麻烦 调用附录(1)会导致以下错误: wx._core.PyAssertionError: C++ assertion "Assert failure" failed at /Users/vagrant/pisi-64bit/tmp/wxPython-3.0.2.0-3/work/wxPytho

我有一个wxPython GUI,有一个非常大的网格。我使用的代码与wxPython演示中的示例类似,即使用PyGridTableBase创建虚拟网格

然而,当我尝试以交互方式将列添加到此网格时,我遇到了麻烦

调用附录(1)会导致以下错误:

wx._core.PyAssertionError: C++ assertion "Assert failure" failed at /Users/vagrant/pisi-64bit/tmp/wxPython-3.0.2.0-3/work/wxPython-src-3.0.2.0/src/generic/grid.cpp(1129) in AppendCols(): 
Called grid table class function AppendCols but your derived table class does not override this function
但是,如果我试图覆盖table类中的
AppendCols
,应用程序就会无限期地挂起,永远不会解析。即使我的自定义
AppendCols
方法中实际上没有任何内容,它也会挂起

class HugeTable(gridlib.PyGridTableBase):

    """                                                                                                             
    Table class for virtual grid                                                                                    
    """

    def __init__(self, log, num_rows, num_cols):
        gridlib.PyGridTableBase.__init__(self)

    def AppendCols(self, *args):
        pass
我已经成功地覆盖了其他方法(setValue、getValue、getColLabelValue等),所以我不确定这里有什么不同

更新:

过了一会儿,我又回到这个问题上来。我不再获得
wx.\uu core.PyAssertionError
。然而,我仍然无法让我的自定义AppendCols方法工作。我不知道要在附录中添加什么才能使新列真正显示出来


我不知道如何查看源代码——Python文档中似乎没有我想要的东西,所以也许我需要深入研究wxWidgets?文档没有帮助:

我需要的线索在的演示代码中

因此,这段代码是有效的(不考虑我的自定义逻辑,只包括基本内容):

 def AppendCols(self, *args):
     msg = gridlib.GridTableMessage(self,  # The table                                               
                           gridlib.GRIDTABLE_NOTIFY_COLS_APPENDED, # what we did to it              
                           1)                                       # how many                      
    self.GetView().ProcessTableMessage(msg)
    return True