1

我需要帮助从我的 ObjectListView 中删除交替颜色。

    self.problist = ObjectListView(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
    self.problist.SetColumns([
            ColumnDefn("Problem", "left", 400, valueGetter="short_des"),
            ColumnDefn("First Treated", "left", 100, valueGetter="prob_date"),
            ColumnDefn("ICD-10 Code", "left", 100, valueGetter="icd10")
            ])
    self.problist.SetObjects(problems)
    self.problist.cellEditMode = ObjectListView.CELLEDIT_DOUBLECLICK
    self.problist.Bind(EVT_CELL_EDIT_STARTING, self.HandleCellEditStarting)
    self.problist.Bind(EVT_CELL_EDIT_FINISHED, self.HandleCellEditFinished)
    self.problist.rowFormatter = self.rowFormatter
    self.problist.useAlternateBackColors = False

我也试过了self.problist.useAlternateBackColors(False)。这会自动设置为 True。在搜索文档后,我没有找到任何关于如何设置此 ObjectListView 属性的指示。

谢谢

4

1 回答 1

1

您需要在加载对象之前设置它。

    self.problist = ObjectListView(self, -1, style=wx.LC_REPORT|wx.SUNKEN_BORDER)
        self.problist.SetColumns([
                ColumnDefn("Problem", "left", 400, valueGetter="short_des"),
                ColumnDefn("First Treated", "left", 100, valueGetter="prob_date"),
                ColumnDefn("ICD-10 Code", "left", 100, valueGetter="icd10")
                ])
        self.problist.useAlternateBackColors = False
        self.problist.SetObjects(problems)
        self.problist.cellEditMode = ObjectListView.CELLEDIT_DOUBLECLICK
        self.problist.Bind(EVT_CELL_EDIT_STARTING,   self.HandleCellEditStarting)
        self.problist.Bind(EVT_CELL_EDIT_FINISHED, self.HandleCellEditFinished)
        self.problist.rowFormatter = self.rowFormatter
于 2015-10-26T19:09:09.430 回答