]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/PrintDialog.py
Move comment to where it can be a true statement ;-)
[wxWidgets.git] / wxPython / demo / PrintDialog.py
CommitLineData
cf694132 1
8fa876ca 2import wx
34a544a6 3
cf694132
RD
4#---------------------------------------------------------------------------
5
34a544a6
RD
6class TestPanel(wx.Panel):
7 def __init__(self, parent, log):
8 self.log = log
9 wx.Panel.__init__(self, parent, -1)
10
11 b = wx.Button(self, -1, "Create and Show a PrintDialog", (50,50))
12 self.Bind(wx.EVT_BUTTON, self.OnButton, b)
13
14
15 def OnButton(self, evt):
16 data = wx.PrintDialogData()
17
18 data.EnableSelection(True)
19 data.EnablePrintToFile(True)
20 data.EnablePageNumbers(True)
21 data.SetMinPage(1)
22 data.SetMaxPage(5)
23 data.SetAllPages(True)
1fded56b 24
34a544a6 25 dlg = wx.PrintDialog(self, data)
1fded56b 26
34a544a6
RD
27 if dlg.ShowModal() == wx.ID_OK:
28 data = dlg.GetPrintDialogData()
29 self.log.WriteText('GetAllPages: %d\n' % data.GetAllPages())
8fa876ca 30
34a544a6 31 dlg.Destroy()
8fa876ca 32
34a544a6
RD
33
34
35#---------------------------------------------------------------------------
36
37
38def runTest(frame, nb, log):
39 win = TestPanel(nb, log)
40 return win
cf694132
RD
41
42#---------------------------------------------------------------------------
43
44
8fa876ca
RD
45overview = """\
46This class represents the print and print setup common dialogs. You may obtain
95bfd958 47a wx.PrinterDC device context from a successfully dismissed print dialog.
cf694132 48
95bfd958 49User information is stored in a wx.PrintDialogData object that is passed to the
8fa876ca
RD
50dialog at creation time, and it is filled in by the user. As with other dialogs,
51do not use this data once the dialog is dismissed, and do not destroy the dialog
52until you have everything you need from it.
cf694132 53
1fded56b 54"""
cf694132
RD
55
56
1fded56b
RD
57if __name__ == '__main__':
58 import sys,os
59 import run
8eca4fef 60 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])