]>
Commit | Line | Data |
---|---|---|
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 PageSetupDialog", (50,50)) | |
12 | self.Bind(wx.EVT_BUTTON, self.OnButton, b) | |
13 | ||
14 | ||
15 | def OnButton(self, evt): | |
16 | data = wx.PageSetupDialogData() | |
17 | data.SetMarginTopLeft( (15, 15) ) | |
18 | data.SetMarginBottomRight( (15, 15) ) | |
19 | #data.SetDefaultMinMargins(True) | |
20 | data.SetPaperId(wx.PAPER_LETTER) | |
21 | ||
22 | dlg = wx.PageSetupDialog(self, data) | |
23 | ||
24 | if dlg.ShowModal() == wx.ID_OK: | |
25 | data = dlg.GetPageSetupData() | |
26 | tl = data.GetMarginTopLeft() | |
27 | br = data.GetMarginBottomRight() | |
28 | self.log.WriteText('Margins are: %s %s\n' % (str(tl), str(br))) | |
29 | ||
30 | dlg.Destroy() | |
31 | ||
32 | ||
33 | #--------------------------------------------------------------------------- | |
34 | ||
35 | ||
36 | def runTest(frame, nb, log): | |
37 | win = TestPanel(nb, log) | |
38 | return win | |
39 | ||
40 | ||
41 | #--------------------------------------------------------------------------- | |
42 | ||
43 | ||
44 | overview = """\ | |
45 | This class represents the page setup common dialog. The page setup dialog is standard | |
46 | from Windows 95 on, replacing the print setup dialog (which is retained in Windows | |
47 | and wxWindows for backward compatibility). On Windows 95 and NT 4.0 and above, | |
48 | the page setup dialog is native to the windowing system, otherwise it is emulated. | |
49 | ||
50 | The page setup dialog contains controls for paper size (A4, A5 etc.), orientation | |
51 | (landscape or portrait), and controls for setting left, top, right and bottom margin | |
52 | sizes in millimetres. | |
53 | ||
54 | When the dialog has been closed, you need to query the <code>wx.PageSetupDialogData</code> object | |
55 | associated with the dialog. | |
56 | ||
57 | Note that the OK and Cancel buttons do not destroy the dialog; this must be done by | |
58 | the application. As with other dialogs, do not destroy the dialog until you are done | |
59 | with the data, and, conversely, do not use the wx.PageSetupDialogData after the | |
60 | dialog is destroyed. | |
61 | ||
62 | ||
63 | """ | |
64 | ||
65 | ||
66 | if __name__ == '__main__': | |
67 | import sys,os | |
68 | import run | |
69 | run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:]) |