- self.log.WriteText("wx.Printout.OnBeginDocument\n")
- return self.base_OnBeginDocument(start, end)
+ self.log.WriteText("MyPrintout.OnBeginDocument\n")
+ return super(MyPrintout, self).OnBeginDocument(start, end)
- self.log.WriteText("wx.Printout.OnEndDocument\n")
- self.base_OnEndDocument()
+ self.log.WriteText("MyPrintout.OnEndDocument\n")
+ super(MyPrintout, self).OnEndDocument()
- self.log.WriteText("wx.Printout.OnBeginPrinting\n")
- self.base_OnBeginPrinting()
+ self.log.WriteText("MyPrintout.OnBeginPrinting\n")
+ super(MyPrintout, self).OnBeginPrinting()
- self.log.WriteText("wx.Printout.OnEndPrinting\n")
- self.base_OnEndPrinting()
+ self.log.WriteText("MyPrintout.OnEndPrinting\n")
+ super(MyPrintout, self).OnEndPrinting()
- self.log.WriteText("wx.Printout.OnPreparePrinting\n")
- self.base_OnPreparePrinting()
+ self.log.WriteText("MyPrintout.OnPreparePrinting\n")
+ super(MyPrintout, self).OnPreparePrinting()
#-------------------------------------------
self.canvas.DoDrawing(dc, True)
#-------------------------------------------
self.canvas.DoDrawing(dc, True)
self.box.Add(self.canvas, 1, wx.GROW)
subbox = wx.BoxSizer(wx.HORIZONTAL)
btn = wx.Button(self, ID_Setup, "Print Setup")
self.box.Add(self.canvas, 1, wx.GROW)
subbox = wx.BoxSizer(wx.HORIZONTAL)
btn = wx.Button(self, ID_Setup, "Print Setup")
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
btn = wx.Button(self, ID_Preview, "Print Preview")
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
btn = wx.Button(self, ID_Preview, "Print Preview")
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
btn = wx.Button(self, ID_Print, "Print")
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
btn = wx.Button(self, ID_Print, "Print")
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
self.box.Add(subbox, 0, wx.GROW)
subbox.Add(btn, 1, wx.GROW | wx.ALL, 2)
self.box.Add(subbox, 0, wx.GROW)
- printerDialog = wx.PrintDialog(self)
- printerDialog.GetPrintDialogData().SetPrintData(self.printData)
- printerDialog.GetPrintDialogData().SetSetupDialog(True)
+ data = wx.PrintDialogData(self.printData)
+ printerDialog = wx.PrintDialog(self, data)
+ #printerDialog.GetPrintDialogData().SetSetupDialog(True)
- 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 when the dialog is destroyed
+ self.printData = wx.PrintData( printerDialog.GetPrintDialogData().GetPrintData() )
+
printerDialog.Destroy()
def OnPrintPreview(self, event):
self.log.WriteText("OnPrintPreview\n")
printerDialog.Destroy()
def OnPrintPreview(self, event):
self.log.WriteText("OnPrintPreview\n")
printout = MyPrintout(self.canvas, self.log)
printout2 = MyPrintout(self.canvas, self.log)
printout = MyPrintout(self.canvas, self.log)
printout2 = MyPrintout(self.canvas, self.log)
if not self.preview.Ok():
self.log.WriteText("Houston, we have a problem...\n")
if not self.preview.Ok():
self.log.WriteText("Houston, we have a problem...\n")
printer = wx.Printer(pdd)
printout = MyPrintout(self.canvas, self.log)
printer = wx.Printer(pdd)
printout = MyPrintout(self.canvas, self.log)
wx.MessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wx.OK)
else:
wx.MessageBox("There was a problem printing.\nPerhaps your current printer is not set correctly?", "Printing", wx.OK)
else: