[wxPython] Suggestion for wxListCtrl

The interface to the wxListCtrl is too C++ like and doesn't really
fit into what I'd like to do in python. In the ideal world, I'd
just like to append entries to the list and now have to play the
insertItem/setItem game. I'd like to be able to do
something like this:

f = [ "field1", "field2", "field3" ]
list.Append (f)

  This is just a question of upping the level of abstraction in
the python interface. Here's a function which could provide the
append functionality:

def Append (self, entry):

  if len (entry):
    pos = self.GetItemCount ()
    self.InsertStringItem (pos, "%s" %entry[0])
    for i in range (1, len (entry)):
      self.SetStringItem (pos, i, "%s" %entry[i])

  What do you guys think? It would be an easy change to make and
quite useful from the programmers perspective.

                 -- Mike

···

--
Michael Gilfix
mgilfix@eecs.tufts.edu

  This is just a question of upping the level of abstraction in
the python interface. Here's a function which could provide the
append functionality:

def Append (self, entry):

if len (entry):
  pos = self.GetItemCount ()
  self.InsertStringItem (pos, "%s" %entry[0])
  for i in range (1, len (entry)):
   self.SetStringItem (pos, i, "%s" %entry[i])

  What do you guys think? It would be an easy change to make and
quite useful from the programmers perspective.

Sounds good.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!

You gonna throw that in or should I submit a patch?

···

On Mon, Mar 04 @ 09:20, Robin Dunn wrote:

> This is just a question of upping the level of abstraction in
> the python interface. Here's a function which could provide the
> append functionality:
>
> def Append (self, entry):
>
> if len (entry):
> pos = self.GetItemCount ()
> self.InsertStringItem (pos, "%s" %entry[0])
> for i in range (1, len (entry)):
> self.SetStringItem (pos, i, "%s" %entry[i])
>
> What do you guys think? It would be an easy change to make and
> quite useful from the programmers perspective.

Sounds good.

--
Michael Gilfix
mgilfix@eecs.tufts.edu

You gonna throw that in or should I submit a patch?

Already done.

···

--
Robin Dunn
Software Craftsman
robin@AllDunn.com Java give you jitters?
http://wxPython.org Relax with wxPython!