]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/PrintDialog.py
moved vararg CRT functions wrappers to a new wxcrtvararg.h header
[wxWidgets.git] / wxPython / demo / PrintDialog.py
1
2 import wx
3
4 #---------------------------------------------------------------------------
5
6 class 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)
24
25 dlg = wx.PrintDialog(self, data)
26
27 if dlg.ShowModal() == wx.ID_OK:
28 data = dlg.GetPrintDialogData()
29 self.log.WriteText('GetAllPages: %d\n' % data.GetAllPages())
30
31 dlg.Destroy()
32
33
34
35 #---------------------------------------------------------------------------
36
37
38 def runTest(frame, nb, log):
39 win = TestPanel(nb, log)
40 return win
41
42 #---------------------------------------------------------------------------
43
44
45 overview = """\
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.
48
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.
53
54 """
55
56
57 if __name__ == '__main__':
58 import sys,os
59 import run
60 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])