]>
git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/PageSetupDialog.py
4 #---------------------------------------------------------------------------
6 class TestPanel(wx
.Panel
):
7 def __init__(self
, parent
, log
):
9 wx
.Panel
.__init
__(self
, parent
, -1)
11 b
= wx
.Button(self
, -1, "Create and Show a PageSetupDialog", (50,50))
12 self
.Bind(wx
.EVT_BUTTON
, self
.OnButton
, b
)
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
)
22 dlg
= wx
.PageSetupDialog(self
, data
)
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
)))
33 #---------------------------------------------------------------------------
36 def runTest(frame
, nb
, log
):
37 win
= TestPanel(nb
, log
)
41 #---------------------------------------------------------------------------
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.
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
54 When the dialog has been closed, you need to query the <code>wx.PageSetupDialogData</code> object
55 associated with the dialog.
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
66 if __name__
== '__main__':
69 run
.main(['', os
.path
.basename(sys
.argv
[0])] + sys
.argv
[1:])