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)
wxpython “m_count > 0“ failed at;;;p(339) in wxRefCounter::DecRef(): 解决
最新推荐文章于 2024-07-27 12:20:46 发布