]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/PrintDialog.py
HandlePrintClient shouldn't go above a top-level window
[wxWidgets.git] / wxPython / demo / PrintDialog.py
... / ...
CommitLineData
1
2import wx
3
4#---------------------------------------------------------------------------
5
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)
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
38def runTest(frame, nb, log):
39 win = TestPanel(nb, log)
40 return win
41
42#---------------------------------------------------------------------------
43
44
45overview = """\
46This class represents the print and print setup common dialogs. You may obtain
47a wx.PrinterDC device context from a successfully dismissed print dialog.
48
49User information is stored in a wx.PrintDialogData object that is passed to the
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.
53
54"""
55
56
57if __name__ == '__main__':
58 import sys,os
59 import run
60 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])