def darkRowFormatter(listctrl, dark=False):
"""
Toggles the rows in a ListCtrl or ObjectListView widget.
"""
listItems = [listctrl.GetItem(i) for i
in range(listctrl.GetItemCount())]
for index, item in enumerate(listItems):
if dark:
if index % 2:
item.SetBackgroundColour("Dark Grey")
else:
item.SetBackgroundColour("Light Grey")
else:
if index % 2:
item.SetBackgroundColour("Light Blue")
else:
item.SetBackgroundColour("Yellow")
listctrl.SetItem(item)
评论列表
文章目录