Example #1
0
def dark_row_formatter(listctrl: wx.ListCtrl, dark: bool = False) -> None:
    """Toggles the row in a ListCtrl"""

    items = [listctrl.GetItem(i) for i in range(listctrl.GetItemCount())]

    for index, item in enumerate(items):
        if dark:
            if index % 2:
                item.SetBackgroundColor(DARK_BACKGROUND_COLOUR)
            else:
                item.SetBackgroundColor(DARK_LIGHTGREY_COLOUR)

        listctrl.SetItem(item)
def dark_row_formatter(listctrl: wx.ListCtrl, dark: bool = False) -> None:
    """Toggles the row in a ListCtrl"""

    items = [listctrl.GetItem(i) for i in range(listctrl.GetItemCount())]

    for index, item in enumerate(items):
        if dark:
            if index % 2:
                item.SetBackgroundColor("Dark Grey")
            else:
                item.SetBackgroundColor("Light Grey")
        else:
            if index % 2:
                item.SetBackgroundColor("Light Blue")
            else:
                item.SetBackgroundColor("Yellow")

        listctrl.SetItem(item)