[wxPython] wxListCtrl_virtual crashes and I can't find what I'm doing wrong

F. GEIGER fgeiger at datec.at
Tue Apr 13 12:18:49 EDT 2004


[Posted to comp.soft-sys.wxwindows and comp.lang.python]


Hi all,

in my MainFrame class I have def'ed a method which is called on idle. There
I retrieve the frame's title for further processing:

currentTitle = self.GetTitle().

No problem so far.

I have a wxNotebook containing several pages. Those pages contain controls
updating themselves, using a wxTimer for that.

No problem so far.

I have added another page containing a control derived from wxListCtrl,
virtual style.

And now I have problems:

This control is named VipAPSpooler. It first used a wxTimer, to update
itself periodically: If the underlying model had changed in the number of
items, it exec'ed a DeleteAllItems() and a SetItemCount().

This did not work: The debugger halted in the MainFrame's(!) on-idle-method
in line

currentTitle = self.GetTitle()

saying "Inappropriate argument type: an integer is required".

I thought, that using too many wxTimer-s could cause this problem (other
controls used timers too to update themselves).

So I decided to eliminate all timers and to write an update method for all
controls that should be able to update themselves. This update-method were
then called from the MainFrames's on-idle-method. The rationale: No more
timers and only one on-idle-method.

But that did not solve the problem. The same and sometimes other weired
errors popped up now in code called by OnGetItemAttr() ans OnGetItemText()
of the virtual wxListCtrl.

Example:

   def __str__(self):
      if self._value: # <- "Inappropriate argument type: an integer is
required".
         return str(self._value)
      return ''

Or this:

   def OnGetItemAttr(self, item):
      if item == self.model().currentLineNbr(): # <- "Inappropriate argument
type: an integer is
         return self._attr
      return None


Executing the offending line in the Debug Probe (yes, it's WingIDE) in each
case passes w/o problems - weird. Looking at the stack data doesn't show any
data corruption, everything seems okay.

I commented out this and that and seem to have found out, that as soon
SetItemCount() is called, the control is no more able to do its job.

I'm stuck in the middle. Despite the fact that my code is cut & pasted from
the demo I am sure to overlook something.

Any idea?

Kind regards
Franz GEIGER

P.S.:
Python 2.3.2 and wxPython 2.4.2.4u on Win2k.
and
Python 2.3.2 and wxPython 2.5.1.5u on WinXP.





More information about the Python-list mailing list