]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/PageSetupDialog.py
added missing button state
[wxWidgets.git] / wxPython / demo / PageSetupDialog.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 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
36def runTest(frame, nb, log):
37 win = TestPanel(nb, log)
38 return win
39
40
41#---------------------------------------------------------------------------
42
43
44overview = """\
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.
49
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.
53
54When the dialog has been closed, you need to query the <code>wx.PageSetupDialogData</code> object
55associated with the dialog.
56
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
59with the data, and, conversely, do not use the wx.PageSetupDialogData after the
60dialog is destroyed.
61
62
63"""
64
65
66if __name__ == '__main__':
67 import sys,os
68 import run
69 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])