wxpython “m_count > 0“ failed at;;;p(339) in wxRefCounter::DecRef(): 解决

choice_editor 其实有一个内部的编号,每一次调用choice editor 即setcelleditor的时候,这个值都需要手动加一 。


self.grid.CreateGrid(row_number, self.col_num )

# self.grid add select list
self.grid_choice_list = ['test1', 'test2']
#choice_editor = wx.grid.GridCellChoiceEditor(self.grid_choice_list,allowOthers=True)
choice_editor = wx.grid.GridCellChoiceEditor(self.grid_choice_list)

for col in range(self.col_num ):
    self.grid.SetColLabelValue(col,rowLabels[col])
    self.grid.SetColSize(col, 125)

for row in range(row_number):
    for col in range(self.col_num ):
        #self.grid.SetCellBackgroundColour(row, col, "light grey")
        self.grid.SetCellBackgroundColour(row, col, "white")
        if col==3:
            self.grid.SetCellEditor(row,col,choice_editor)
            choice_editor.IncRef()  # 手动加1
            print(choice_editor.GetRefCount())# 看看有无变化
            self.grid.SetCellValue(row,col,self.grid_choice_list[0])
            #self.grid.SetReadOnly(row, col)
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值