LinuxQuestions.org

LinuxQuestions.org (/questions/)
-   Programming (https://www.linuxquestions.org/questions/programming-9/)
-   -   wxPython ListCTRL problems (stumbling in the dark) (https://www.linuxquestions.org/questions/programming-9/wxpython-listctrl-problems-stumbling-in-the-dark-173469/)

Dark Carnival 04-22-2004 05:40 PM

wxPython ListCTRL problems (stumbling in the dark)
 
Heya!
No doubt python is nice (really nice!). No doubt wxPython certainly has features and it's nice looking too. But the main problem I have with it, is the lack of documentation.

www.spido.dk/hostile/listctrl.py

I try to make this small list work but at lines 48-56 it barfs all over the place. This is one of the lines:
self.list_ctrl_1.SetStringItem(x, 1, data[1])

The error I get is:
------------------------------------------------------
Traceback (most recent call last):
File "blaze.py", line 79, in ?
app = MyApp(0)
File "/usr/lib/python2.3/site-packages/wxPython/wx.py", line 1951, in __init__ _wxStart(self.OnInit)
File "blaze.py", line 71, in OnInit
listname = list(None, -1, "")
File "blaze.py", line 25, in __init__
self.__do_layout()
File "blaze.py", line 48, in __do_layout
self.list_ctrl_1.SetStringItem(x, 1, data[1])
File "/usr/lib/python2.3/site-packages/wxPython/controls2.py", line 474, in SetStringItem
val = controls2c.wxListCtrl_SetStringItem(self, *_args, **_kwargs)
wxPython.wxc.wxPyAssertionError: C++ assertion "wxAssertFailure" failed in /usr/src/redhat/BUILD/wxPythonSrc-2.4.2.4/src/generic/listctrl.cpp(3856): invalid item index in SetItem
-----------------------------------------------------

Now I've been in trouble before, and eventually (most of the time) you can figure it out. But this is bugging me since I can't make much sense of that error, nor do I have much luck finding any documentation of a proper usage of wxlistctrl (apart from the wxpythondemo example which I certainly try to build a bit after, but as with many of the examples, it's way too loaded with extra features IMHO)

I'm really hoping someone has had a mess with this before and can see the mistake(s) I've made, and most importantly, -explain what it is and how I should be doing.

Thanks in advance!


All times are GMT -5. The time now is 03:36 PM.