Sam23 wrote:
<<Is the problem that the ApptGrid window is not filling the notebook
page? >>
The ApptGrid actually seems to be overflowing the notebook page!
(further details below). The problem seems to be that the AuiNotebook
is not expanding to fill available space in the panel that contains it
(OuterPanel aka self.op). The AuiNotebook expands fine, if it doesn't
contain a CalendarPanel object. Once CalendarPanel is added to its
pages, AuiNotebook collapses to a tiny size of (96, 76).<< If so then it's just because it's given a specific size of
(300,300) and that the parent
CalendarPanel does not have a sizer to manage the position and size of
its child so it stays at (0,0) (300,300).>>
[...]
This seems to expand it correctly when there is no AuiNotebook
involved; i.e. it is directly added to OuterPanel (wx.Panel) without
AuiNotebook as its parent. I tried changing the default size setting
to (-1, -1) instead of (300, 300), but it didn't seem to make any
difference.<< (Set the CalendarPanel's bg color to something else to verify that,
or use the WIT's Highlight tool.)>>I set CalendarPanel bg colour to Yellow, and yellow fills the
AuiNotebook, which is tiny. The blue still fills most of the
containing panel.
That is not what I'm seeing, maybe I didn't reenable the right lines in Werner's version of the files. (This is why I always ask for a *small* standalone sample, so confusions like this don't happen.)
Looking at the code and the hierarchy I just described, I suspect that
I may have messed up the sizers/parenting of these windows within
CalendarPanel. Ouch. I will take a closer look again.
Try ripping out everything that is not essential to make this crash happen. (Or start from scratch and make a new app that has the same problem.) That will help to isolate the cause of the problem and may even enable you to figure out what the problem is yourself.
One thing that I noticed is that the organization of your code and the objects is fairly messy. For example the ApptGrid uses a sizer but it is entirely managed outside of the ApptGrid class. Some widgets add themselves to this sizer, others are added to it from the CalendarPanel when it creates the widgets, etc. Using proper OOP encapsulation you should make the ApptGrid own and manage its own sizer, and probably also manage the adding of child widgets to itself.
If you reorganize the code to be more compliant to OO principles then you'll be less likely to get lost and make mistakes.
<< The problems may be related. For example, if you have a loop in
the
sizer containment then something may be being destroyed twice, which
would cause a crash like you're seeing. >>Is this sizer containment Destroy() loop something inside my python
code or is this c++ code? Should I be looking for Destroy() in my
python code?
It's in C++. When a window is destroyed then it will destroy its sizer, which will destroy its nested sizers, etc.
If a loop always incorrectly destroys an item twice, should this
always cause a crash, or could it be intermittent? The exception is
intermittent even with the exact same sequence and data.
It could be intermittent.
···
--
Robin Dunn
Software Craftsman