[wxPython-users] Setting Page Data for Printing
Jürgen Kareta
python at kareta.de
Tue Sep 19 06:31:01 PDT 2006
Rich Shepard schrieb:
> On Mon, 18 Sep 2006, Robin Dunn wrote:
>
>>> data = dlg.GetPageSetupData()
>>> self.data = wx.PrintData(data.GetPrintData()) # force a copy
>>> self.data.SetPaperId(wx.PAPER_LETTER)
>>
>
>> As shown in the sample in the book you can set defaults like that in the
>> wx.PrintData object before you start the whole printing process. It's
>> used to carry settings info between the various dialogs and the print
>> job.
>
>
> Robin,
>
> That's what I thought that I had done with the above line. Is the
> syntax
> incorrect?
>
> I have not found where I can change the default values in the
> dialogs. For
> example, why the dialog box displays A4 as the paper size and why the
> default printer is 'generic' rather than what CUPS and other applications
> see. When I grep'd the example code for 'PaperId' only the immediately
> visible lines were found. Is it possible to change these default values
> (including unchecking the 'print in color') elsewhere?
>
> Many thanks,
>
> Rich
>
Hi Rich,
if you want to change the default values of the dialog, you have to set
the values before you show the dialog.
def OnPageSetup(self, evt):
data = wx.PageSetupDialogData()
data.SetPaperId(wx.PAPER_LETTER)
dlg = wx.PageSetupDialog(self, data)
regards,
Jürgen
More information about the wxpython-users
mailing list