This problem was not there with Version 2.5.3.1 but appeared after I
updated to 2.6.0.0 The attached example used 2.6.1.0.pre20050602 and
Windows XP SP2 - I *think* OS X is OK but I can't replicate exactly the
same environment at the moment.
A bitmap containing a pie chart is displayed in a window. When the window
is resized, the bitmap is regenerated so it always fills the window. The
attached screen shot shows what happens when the apps main frame is
maximised - the area originally occupied by the graph window is not being
updated, only the area where the window has grown. The code producing this
is:
def OnPaint(self, event):
if self.vieweditem:
dc = wx.PaintDC(self.graphwin)
self.RedrawGraph(dc)
event.Skip()
def RedrawGraph(self, dc, pageno=None):
""" If size and pageno unchanged, redisplay bitmap
otherwise redraw graph for required page and size
"""
dc.BeginDrawing()
if pageno is None:
pageno = self.pageno
if (self.graphwin.GetSizeTuple() != self.size
or pageno != self.pageno):
self.size = self.graphwin.GetSizeTuple()
self.pageno = pageno
self.vieweditem.DrawGraphPage(self.pageno, self.size)
self.bitmap =
wx.Image(self.vieweditem.filename).ConvertToBitmap()
dc.DrawBitmap(self.bitmap, 0, 0, True)
dc.EndDrawing()
I thought adding a Refresh() at the end of the function might help, but
doing that results in a completely blank window.
"wxMSW: Patch #1197009, better refreshes when windows are moved and
resized." - This change was done recently, but I can't find any details on
the wxWidgets site.
> def OnPaint(self, event):
> if self.vieweditem:
> dc = wx.PaintDC(self.graphwin)
> self.RedrawGraph(dc)
> event.Skip()
Do you need the Skip(). I've never needed it in an OnPaint handler, it could be that the event getting handled by the system and messing up what you've drawn later.
Also, this is probalby just a code style issue, you seem to have a graphwin on another Window that is gettignupdated by binding in teh parent window. I'd tend to create a class for the graph Window, and handle Painting of the window there. That makes it a little more clear what is happening where.
-Chris
David Hughes wrote:
···
This problem was not there with Version 2.5.3.1 but appeared after I updated to 2.6.0.0 The attached example used 2.6.1.0.pre20050602 and Windows XP SP2 - I *think* OS X is OK but I can't replicate exactly the same environment at the moment.
A bitmap containing a pie chart is displayed in a window. When the window is resized, the bitmap is regenerated so it always fills the window. The attached screen shot shows what happens when the apps main frame is maximised - the area originally occupied by the graph window is not being updated, only the area where the window has grown. The code producing this is:
def OnPaint(self, event):
if self.vieweditem:
dc = wx.PaintDC(self.graphwin)
self.RedrawGraph(dc)
event.Skip()
def RedrawGraph(self, dc, pageno=None):
""" If size and pageno unchanged, redisplay bitmap
otherwise redraw graph for required page and size
"""
dc.BeginDrawing()
if pageno is None:
pageno = self.pageno
if (self.graphwin.GetSizeTuple() != self.size
or pageno != self.pageno):
self.size = self.graphwin.GetSizeTuple()
self.pageno = pageno
self.vieweditem.DrawGraphPage(self.pageno, self.size)
self.bitmap = wx.Image(self.vieweditem.filename).ConvertToBitmap()
dc.DrawBitmap(self.bitmap, 0, 0, True)
dc.EndDrawing()
I thought adding a Refresh() at the end of the function might help, but doing that results in a completely blank window.
"wxMSW: Patch #1197009, better refreshes when windows are moved and resized." - This change was done recently, but I can't find any details on the wxWidgets site.
Regards,
David Hughes
Forestfield Software
www.foresoft.co.uk
---------------------------------------------------------------------
To unsubscribe, e-mail: wxPython-users-unsubscribe@lists.wxwidgets.org
For additional commands, e-mail: wxPython-users-help@lists.wxwidgets.org
--
Christopher Barker, Ph.D.
Oceanographer
NOAA/OR&R/HAZMAT (206) 526-6959 voice
7600 Sand Point Way NE (206) 526-6329 fax
Seattle, WA 98115 (206) 526-6317 main reception
A bitmap containing a pie chart is displayed in a window. When the window is resized, the bitmap is regenerated so it always fills the window. The attached screen shot shows what happens when the apps main frame is maximised - the area originally occupied by the graph window is not being updated, only the area where the window has grown. The code producing this is:
By default only the newly exposed areas of a window are set to refresh when the window is resized, and the rest of the winddow is clipped. You can call Refresh in the EVT_SIZE handler to cause all of the window to be part of the update region, or you can use the wx.FULL_REPAINT_ON_RESIZE style flag when creating the window.
···
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!
> A bitmap containing a pie chart is displayed in a window. When the
> window is resized, the bitmap is regenerated so it always fills the
> window. The attached screen shot shows what happens when the apps
> main frame is maximised - the area originally occupied by the graph
> window is not being updated, only the area where the window has
> grown. The code producing this is:
By default only the newly exposed areas of a window are set to refresh
when the window is resized, and the rest of the winddow is clipped.
You can call Refresh in the EVT_SIZE handler to cause all of the window
to be part of the update region, or you can use the
wx.FULL_REPAINT_ON_RESIZE style flag when creating the window.
Thanks Robin, I had a good idea there was a flag that controlled this - I
was just looking in the wrong place for it (doh!)