#-------------------------------------------
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)
+ data = wx.PrintDialogData(self.printData)
+ printerDialog = wx.PrintDialog(self, data)
- 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()
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: