]> git.saurik.com Git - wxWidgets.git/blobdiff - wxPython/demo/PrintFramework.py
Ensure that runTest is not modal, even when a required module is not
[wxWidgets.git] / wxPython / demo / PrintFramework.py
index df1004bce786abb9d95ffe50e4999b987685ee80..5db34aaa3ee2bf84d798e6c1596380228b425675 100644 (file)
@@ -84,7 +84,7 @@ class MyPrintout(wx.Printout):
         #-------------------------------------------
 
         self.canvas.DoDrawing(dc, True)
-        dc.DrawText("Page: %d" % page, (marginX/2, maxY-marginY))
+        dc.DrawText("Page: %d" % page, marginX/2, maxY-marginY)
 
         return True
 
@@ -130,7 +130,12 @@ class TestPrintPanel(wx.Panel):
         printerDialog = wx.PrintDialog(self, data)
         printerDialog.GetPrintDialogData().SetSetupDialog(True)
         printerDialog.ShowModal();
-        self.printData = printerDialog.GetPrintDialogData().GetPrintData()
+
+        # this makes a copy of the wx.PrintData instead of just saving
+        # a reference to the one inside the printDialogData that will
+        # be destroyed
+        self.printData = wx.PrintData( printerDialog.GetPrintDialogData().GetPrintData() )
+        
         printerDialog.Destroy()
 
 
@@ -163,7 +168,7 @@ class TestPrintPanel(wx.Panel):
         if not printer.Print(self.frame, printout, True):
             wx.MessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wx.OK)
         else:
-            self.printData = printer.GetPrintDialogData().GetPrintData()
+            self.printData = wx.PrintData( printer.GetPrintDialogData().GetPrintData() )
         printout.Destroy()