Scaling Problem in Print Preview...

wxPythoners,

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?

Thom Ives

rectangle2.py (4.67 KB)

ThomPrint.py (2.42 KB)

Thom Ives wrote:

wxPythoners,

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.

--- rectangle2.py 2003-11-03 15:09:19.000000000 -0800
+++ rectangle3.py 2003-11-03 15:09:10.000000000 -0800
@@ -23,7 +23,6 @@
          EVT_CHAR(self, self.EvtChar)

      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!