wx.adv.GenericCalendarCtrl crashes the frame when using SetAttr()

Hi,
My Project involves making entries in a List for each day. To know which days already have an entry, I mark them with a green background colour using
SetAttr(daytomark,markstyle), where daytomark is the number for the day and markstyle is wx.adv.CalendarDateAttr(colBack=‘green’).

This works well for the initial view of the calendar. When changing to a different month with markings (markings are updated for the newly selected month using SetAttr()) things still look good. But when changing to the previous month or to another month with markings the program crashes and I don’t receive any errors (I did set app = wx.App(0)).

I sank hours into this and tried various workarounds, including using frame.Destroy(), setting app=None and starting it again with the new month. The Issue remains. I would really appreciate a hint.

Best,
Robert

Hi Robert,

I raised this issue previously on GitHub:

I have added a comment to that issue. The way that I prevented the crashes from happening was to create a new CalendarDateAttr object before every call to SetAttr().

e.g.

    highlight_attr = wx.adv.CalendarDateAttr(font=self.bold_font)
    self.calendar_ctrl.SetAttr(d, highlight_attr)

Awesome, that worked. Thank you very much!