[wxPython] wxListBox->InsertItems?

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

[wxPython] wxListBox->InsertItems?

Bruce Rabine

I'm trying to implement simple "Up" and "Down" buttons under a wxListBox
to move the selected item up or down in the list.

The documentation for the wxListBox shows a method called "InsertItems",
but I get an 'AttributeError' when trying to access it.
I looked in the file 'controls.py', and it's not there!

Is there any way to insert an item into a wxListBox at a given index?

Is my only choice to change everything to use a wxListCtrl instead?
(there's a lot of legacy code involved here...)

Thanx in advance,

Bruce


(btw: I'm using the wxPython 2.1b3 precompiled for NT 4.0 )

+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +
| Bruce Rabine              e-mail:  [hidden email] |
+ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - +




_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users



Reply | Threaded
Open this post in threaded view
|

Re: [wxPython] wxListBox->InsertItems?

Robin Dunn
> I'm trying to implement simple "Up" and "Down" buttons under a wxListBox
> to move the selected item up or down in the list.
>
> The documentation for the wxListBox shows a method called "InsertItems",
> but I get an 'AttributeError' when trying to access it.
> I looked in the file 'controls.py', and it's not there!
>

That method is a more recent addition and so got overlooked for wxPython.
It is there now for the next release.


> Is there any way to insert an item into a wxListBox at a given index?
>
> Is my only choice to change everything to use a wxListCtrl instead?
> (there's a lot of legacy code involved here...)

If there is not too many items, you can Clear them and add them again.
Otherwise, InsertItems will be there as soon as I can make another release.

--
Robin Dunn
Software Craftsman
[hidden email]
http://AllDunn.com/robin/
http://AllDunn.com/wxPython/  Check it out!



_______________________________________________
wxPython-users maillist  -  [hidden email]
http://starship.python.net/mailman/listinfo/wxpython-users