I finally realized that I could set the wxPanel’s size during construction to (0,0) which seems to do the trick. No more flickering, although I still find it weird that I’m forced to establish the relationship at construction and that the object is visible. With Win32 I would have worked around such an issue by not including the WS_VISIBLE style at creation and then making it visible at the appropriate time.
···
From: Steven Reddie [mailto:smr@essemer.com.au]
Sent: Thursday, 11 August 2005 1:40 PM
To:
wx-users@lists.wxwidgets.org; wxPython-users@lists.wxwidgets.org
Subject: [wxPython-users] RE: wxNotebook display glitch when adding a page
I should have mentioned that this is on Windows XP SP2.
I downloaded the wxWidgets 2.6.1 kit and tried the widgets.exe Notebook test. Clicking on the “Add page” button shows some flickering over the first tab (upper-left corner) however it is a longer and shallower area in this case (maybe 100x10 pixels). So, it’s seeming like a wxWidgets bug rather than wxPython, but perhaps something inherent in the design due to the forced parent-child relationship that must be established before adding a page. If anyone can give me any more details on this (whether there is agreement that this is a bug, a workaround available, etc) I would greatly appreciate it.
Thanks,
Steven
From: Steven Reddie [mailto:smr@essemer.com.au]
Sent: Thursday, 11 August 2005 12:13 PM
To:
wxPython-users@lists.wxwidgets.org; wx-users@lists.wxwidgets.org
Subject: wxNotebook display glitch when adding a page
Hi,
I’m new to wxPython, and haven’t used wxWindows outside of this, so I’m cross-posting because I suspect it’s a wxWindows problem. Please forgive me, and let me know, if this is bad etiquette.
I have a wxNotebook and am adding pages to it. In order to call AddPage I must first have an object to add, but in order to have an object to add I must first have a parent. The problem is that when I create the object with the notebook specified as the parent, just before calling AddPage, I get a 20x20 pixel image drawn in the top-left corner of the notebook, on top of the first tab. As soon as I call AddPage it is redrawn correctly.
The behaviour can be seen more easily by dropping the AddPage call altogether, ie. just doing something like:
panel = wxPanel(self.notebook, -1)
will put a 20x20 light-gray box over the first tab in the top-left corner of the notebook. If it’s a button then I’ll see the button instead – it’s obviously just positioning and drawing the child window as the parent-child relationship specifies.
I can’t find a way to get around this. It seems that windows are created visible so I can’t create the panel initially hidden and add it as a new page before calling Show. I couldn’t locate any sort of “don’t do any drawing updates for the moment” functionality.
Is there a workaround, or can someone at least confirm whether this is or isn’t a bug in wxPython/wxWindows?
Regards,
Steven