]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/PrintDialog.py
4 #---------------------------------------------------------------------------
6 class TestPanel(wx
.Panel
):
7 def __init__(self
, parent
, log
):
9 wx
.Panel
.__init
__(self
, parent
, -1)
11 b
= wx
.Button(self
, -1, "Create and Show a PrintDialog", (50,50))
12 self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
)
15 def OnButton(self
, evt
):
16 data
= wx
.PrintDialogData()
18 data
.EnableSelection(True)
19 data
.EnablePrintToFile(True)
20 data
.EnablePageNumbers(True)
23 data
.SetAllPages(True)
25 dlg
= wx
.PrintDialog(self
, data
)
27 if dlg
.ShowModal() == wx
.ID_OK
:
28 data
= dlg
.GetPrintDialogData()
29 self
.log
.WriteText('GetAllPages: %d\n' % data
.GetAllPages())
35 #---------------------------------------------------------------------------
38 def runTest(frame
, nb
, log
):
39 win
= TestPanel(nb
, log
)
42 #---------------------------------------------------------------------------
46 This class represents the print and print setup common dialogs. You may obtain
47 a wx.PrinterDC device context from a successfully dismissed print dialog.
49 User information is stored in a wx.PrintDialogData object that is passed to the
50 dialog at creation time, and it is filled in by the user. As with other dialogs,
51 do not use this data once the dialog is dismissed, and do not destroy the dialog
52 until you have everything you need from it.
57 if __name__
== '__main__':
60 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])