Attached is a simple piece of code that I have been working on to help me learn some things I wanted to learn to do with wxPython.
I have heavily plagerized pieces from the wxScrolledWindow and PrintFramework demos in the wxPython demo to get it this far, and I have also received some good help from Robin Dunn.
The thing I cannot figure out (yet) from looking at the demo examples is why my rectangle will not scale when I change the print preview view size, but the print framework images will change sizes proportionally with the print preview view size.
Attached is a simple piece of code that I have been working on to help me learn some things I wanted to learn to do with wxPython.
I have heavily plagerized pieces from the wxScrolledWindow and PrintFramework demos in the wxPython demo to get it this far, and I have also received some good help from Robin Dunn.
The thing I cannot figure out (yet) from looking at the demo examples is why my rectangle will not scale when I change the print preview view size, but the print framework images will change sizes proportionally with the print preview view size.
Can anyone take a look and see what I am missing?
You don't want to call PrepareDC when drawing to the printer or printpreview, only when drawing on the scrolled window itself.
def DoDrawing(self, dc):
- self.PrepareDC(dc) # This is important for ScroledWindows
dc.Clear()
dc.BeginDrawing()
dc.SetPen(wxPen('BLUE', 3))
@@ -32,10 +31,12 @@
def OnPaint(self, evt):
dc = wxPaintDC(self)
+ self.PrepareDC(dc) # This is important for ScroledWindows
self.DoDrawing(dc) #wxClientDC(self)) #self.DoDrawing(dc)
def EvtChar(self, evt):
dc = wxClientDC(self)
+ self.PrepareDC(dc) # This is important for ScroledWindows
self.xpos = self.xpos + 75
self.DoDrawing(dc) #wxClientDC(self)) #self.DoDrawing(dc)
ยทยทยท
--
Robin Dunn
Software Craftsman http://wxPython.org Java give you jitters? Relax with wxPython!