Alternating background color for every other row in a wxListCtrl using wx.LC_REPORT mode

Is it possible to alternate the background color for every other row
for a ListControl in report mode,
or do I need to use a rich text control for that?

I'm trying to make the text easier to view, especially when there are
100's of items in a list.

Hi,

···

On Wed, Nov 18, 2009 at 5:08 PM, cappy2112 <cappy2112@gmail.com> wrote:

Is it possible to alternate the background color for every other row
for a ListControl in report mode,
or do I need to use a rich text control for that?

I'm trying to make the text easier to view, especially when there are
100's of items in a list.

I added a mixin for this a few releases back

See: wx.lib.mixins.listctrl.ListRowHighlighter

Cody

Cody Precord wrote:

Hi,

Is it possible to alternate the background color for every other row
for a ListControl in report mode,
or do I need to use a rich text control for that?

I'm trying to make the text easier to view, especially when there are
100's of items in a list.
    
I added a mixin for this a few releases back

See: wx.lib.mixins.listctrl.ListRowHighlighter

Hi Cody,

I came across this mixin a few weeks ago, it was very useful for my ListCtrl. Many thanks!

···

On Wed, Nov 18, 2009 at 5:08 PM, cappy2112 <cappy2112@gmail.com> wrote:

--
Steven Sproat, BSc
http://www.basicrpg.com/

Neat, I just switched my code to use this too. However, it doesn’t account for re-sorting; I’d suggest adding this to the init method:

self.Bind(wx.EVT_LIST_COL_CLICK, lambda evt: self.RefreshRows())

thanks,

Nat

···

On Wed, Nov 18, 2009 at 3:13 PM, Cody Precord codyprecord@gmail.com wrote:

Is it possible to alternate the background color for every other row

for a ListControl in report mode,

or do I need to use a rich text control for that?

I’m trying to make the text easier to view, especially when there are

100’s of items in a list.

I added a mixin for this a few releases back

See: wx.lib.mixins.listctrl.ListRowHighlighter

You should check out ObjectListView, it's a nice wrapper for
wx.listctrl and handles row highlighting and sorting easily

http://objectlistview.sourceforge.net/python/

···

On Nov 18, 6:44 pm, Nathaniel Echols <nathaniel.ech...@gmail.com> wrote:

On Wed, Nov 18, 2009 at 3:13 PM, Cody Precord <codyprec...@gmail.com> wrote:
> > Is it possible to alternate the background color for every other row
> > for a ListControl in report mode,
> > or do I need to use a rich text control for that?

> > I'm trying to make the text easier to view, especially when there are
> > 100's of items in a list.

> I added a mixin for this a few releases back

> See: wx.lib.mixins.listctrl.ListRowHighlighter

Neat, I just switched my code to use this too. However, it doesn't account
for re-sorting; I'd suggest adding this to the __init__ method:

  self\.Bind\(wx\.EVT\_LIST\_COL\_CLICK, lambda evt: self\.RefreshRows\(\)\)

thanks,
Nat

nice- but it's not part of the standard wx distribution (yet)

···

On Nov 18, 5:50 pm, michael h <michaelke...@gmail.com> wrote:

You should check out ObjectListView, it's a nice wrapper for
wx.listctrl and handles row highlighting and sorting easily

ObjectListView — ObjectListView v1.2 documentation

On Nov 18, 6:44 pm, Nathaniel Echols <nathaniel.ech...@gmail.com> > wrote:

> On Wed, Nov 18, 2009 at 3:13 PM, Cody Precord <codyprec...@gmail.com> wrote:
> > > Is it possible to alternate the background color for every other row
> > > for a ListControl in report mode,
> > > or do I need to use a rich text control for that?

> > > I'm trying to make the text easier to view, especially when there are
> > > 100's of items in a list.

> > I added a mixin for this a few releases back

> > See: wx.lib.mixins.listctrl.ListRowHighlighter

> Neat, I just switched my code to use this too. However, it doesn't account
> for re-sorting; I'd suggest adding this to the __init__ method:

> self.Bind(wx.EVT_LIST_COL_CLICK, lambda evt: self.RefreshRows())

> thanks,
> Nat

Download it into your program's source and import it into your scripts

cappy2112 wrote:

···

nice- but it's not part of the standard wx distribution (yet)

On Nov 18, 5:50 pm, michael h <michaelke...@gmail.com> wrote:
  

You should check out ObjectListView, it's a nice wrapper for
wx.listctrl and handles row highlighting and sorting easily

ObjectListView — ObjectListView v1.2 documentation

On Nov 18, 6:44 pm, Nathaniel Echols <nathaniel.ech...@gmail.com> >> wrote:

On Wed, Nov 18, 2009 at 3:13 PM, Cody Precord <codyprec...@gmail.com> wrote:
      

Is it possible to alternate the background color for every other row
for a ListControl in report mode,
or do I need to use a rich text control for that?
          I'm trying to make the text easier to view, especially when there are
100's of items in a list.
          

I added a mixin for this a few releases back
        See: wx.lib.mixins.listctrl.ListRowHighlighter
        

Neat, I just switched my code to use this too. However, it doesn't account
for re-sorting; I'd suggest adding this to the __init__ method:
            self.Bind(wx.EVT_LIST_COL_CLICK, lambda evt: self.RefreshRows())
      thanks,
Nat
      
--
Steven Sproat, BSc
http://www.basicrpg.com/

I use objectlistview for a couple of projects and it does this
automatically. It's got lots of other nice features. Andrea Gavana
also has a pure python implementation of the listctrl on his website:

http://xoomer.alice.it/infinity77/main/UltimateListCtrl.html

HTH

···

On Nov 19, 1:07 am, cappy2112 <cappy2...@gmail.com> wrote:

nice- but it's not part of the standard wx distribution (yet)

On Nov 18, 5:50 pm, michael h <michaelke...@gmail.com> wrote:

> You should check out ObjectListView, it's a nice wrapper for
> wx.listctrl and handles row highlighting and sorting easily

>ObjectListView — ObjectListView v1.2 documentation

> On Nov 18, 6:44 pm, Nathaniel Echols <nathaniel.ech...@gmail.com> > > wrote:

> > On Wed, Nov 18, 2009 at 3:13 PM, Cody Precord <codyprec...@gmail.com> wrote:
> > > > Is it possible to alternate the background color for every other row
> > > > for a ListControl in report mode,
> > > > or do I need to use a rich text control for that?

> > > > I'm trying to make the text easier to view, especially when there are
> > > > 100's of items in a list.

> > > I added a mixin for this a few releases back

> > > See: wx.lib.mixins.listctrl.ListRowHighlighter

> > Neat, I just switched my code to use this too. However, it doesn't account
> > for re-sorting; I'd suggest adding this to the __init__ method:

> > self.Bind(wx.EVT_LIST_COL_CLICK, lambda evt: self.RefreshRows())

> > thanks,
> > Nat

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org

What I should have said is- we don't use lone code/packages where I
work, only formalized/released packages that are supported and well
known (ie, wx, pythonwin)

However, for my own personal projects I would give it a try.

···

On Nov 19, 4:31 am, Steven Sproat <spro...@gmail.com> wrote:

Download it into your program's source and import it into your scripts

cappy2112 wrote:
> nice- but it's not part of the standard wx distribution (yet)

> On Nov 18, 5:50 pm, michael h <michaelke...@gmail.com> wrote:

>> You should check out ObjectListView, it's a nice wrapper for
>> wx.listctrl and handles row highlighting and sorting easily

>>ObjectListView — ObjectListView v1.2 documentation

>> On Nov 18, 6:44 pm, Nathaniel Echols <nathaniel.ech...@gmail.com> > >> wrote:

>>> On Wed, Nov 18, 2009 at 3:13 PM, Cody Precord <codyprec...@gmail.com> wrote:

>>>>> Is it possible to alternate the background color for every other row
>>>>> for a ListControl in report mode,
>>>>> or do I need to use a rich text control for that?

>>>>> I'm trying to make the text easier to view, especially when there are
>>>>> 100's of items in a list.

>>>> I added a mixin for this a few releases back

>>>> See: wx.lib.mixins.listctrl.ListRowHighlighter

>>> Neat, I just switched my code to use this too. However, it doesn't account
>>> for re-sorting; I'd suggest adding this to the __init__ method:

>>> self.Bind(wx.EVT_LIST_COL_CLICK, lambda evt: self.RefreshRows())

>>> thanks,
>>> Nat

--
Steven Sproat, BSchttp://www.basicrpg.com/

Well, you can probably take a look at the wrapper for ideas on how to
hack the listctrl to your liking, even if you cannot use it.

···

On Nov 20, 12:26 am, cappy2112 <cappy2...@gmail.com> wrote:

What I should have said is- we don't use lone code/packages where I
work, only formalized/released packages that are supported and well
known (ie, wx, pythonwin)

However, for my own personal projects I would give it a try.

-------------------
Mike Driscoll

Blog: http://blog.pythonlibrary.org