]> git.saurik.com Git - wxWidgets.git/blame - wxPython/demo/PageSetupDialog.py
Added Get/SetItemToolTip
[wxWidgets.git] / wxPython / demo / PageSetupDialog.py
CommitLineData
cf694132 1
8fa876ca 2import wx
cf694132
RD
3
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 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
cf694132 36def runTest(frame, nb, log):
34a544a6
RD
37 win = TestPanel(nb, log)
38 return win
39
cf694132
RD
40
41#---------------------------------------------------------------------------
42
43
1fded56b 44overview = """\
8fa876ca
RD
45This class represents the page setup common dialog. The page setup dialog is standard
46from Windows 95 on, replacing the print setup dialog (which is retained in Windows
47and wxWindows for backward compatibility). On Windows 95 and NT 4.0 and above,
48the page setup dialog is native to the windowing system, otherwise it is emulated.
cf694132 49
8fa876ca
RD
50The 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
52sizes in millimetres.
cf694132 53
95bfd958 54When the dialog has been closed, you need to query the <code>wx.PageSetupDialogData</code> object
8fa876ca 55associated with the dialog.
cf694132 56
8fa876ca
RD
57Note that the OK and Cancel buttons do not destroy the dialog; this must be done by
58the application. As with other dialogs, do not destroy the dialog until you are done
95bfd958 59with the data, and, conversely, do not use the wx.PageSetupDialogData after the
8fa876ca 60dialog is destroyed.
cf694132
RD
61
62
8fa876ca
RD
63"""
64
cf694132 65
1fded56b
RD
66if __name__ == '__main__':
67 import sys,os
68 import run
8eca4fef 69 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])