Error With wxCalendarCtrl.SetAttr()

I'm trying to set the attribute of days in the wxCalendarCtrl.
Unfortunately, my code is crashing -- not raising a Pythin exception,
but producing a Windows message about accessing memory at a bad
location.

I've got Windows NT4 SP6, python 2.3.4, and wxPython 2.4.0.7.

Heser's the code, with print statements inserted:

  for iDate in datesDict.keys():
    if iDate[:6] == matchString:
      theDay = int(iDate[6:8])
      theAttr = GetDayAttribute(datesDict[iDate])
      print theDay, `theAttr`
      theCalendar.SetAttr(theDay, theAttr)
      print "Set Attr Accomplished"

Here's the result, showing the crash in the second SetAttr()

  239
  19 <C wxCalendarDateAttr instance at _1e74460_wxCalendarDateAttr_p>
  Set Attr Accomplished
  239
  24 <C wxCalendarDateAttr instance at _1e73e70_wxCalendarDateAttr_p>

Output ends there, showing that that the second SetAttr() failed.
The attributes and the 239's are coming from here:

    def GetDayAttribute(scheduledStuff):
        m = 255 - 4 * scheduledStuff
        print m
        return wxCalendarDateAttr(wxBLACK, colBack=wxColour(255, m, m))

TIA for any advice or repair.

Al

achrist@easystreet.com wrote:

I'm trying to set the attribute of days in the wxCalendarCtrl.
Unfortunately, my code is crashing -- not raising a Pythin exception,
but producing a Windows message about accessing memory at a bad
location.

I've got Windows NT4 SP6, python 2.3.4, and wxPython 2.4.0.7.

                             ^^^^^^^^^^^^
Working far in the future, eh?

Heser's the code, with print statements inserted:

Please distill it down to a small but complete sample that shows the problem and I'll run through it.

···

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