]> git.saurik.com Git - wxWidgets.git/blame_incremental - wxPython/demo/ColourDialog.py
GetFirstChild does't need the cookie anymore
[wxWidgets.git] / wxPython / demo / ColourDialog.py
... / ...
CommitLineData
1
2import wx
3
4#---------------------------------------------------------------------------
5
6def runTest(frame, nb, log):
7 dlg = wx.ColourDialog(frame)
8
9 # Ensure the full colour dialog is displayed,
10 # not the abbreviated version.
11 dlg.GetColourData().SetChooseFull(True)
12
13 if dlg.ShowModal() == wx.ID_OK:
14
15 # If the user selected OK, then the dialog's wx.ColourData will
16 # contain valid information. Fetch the data ...
17 data = dlg.GetColourData()
18
19 # ... then do something with it. The actual colour data will be
20 # returned as a three-tuple (r, g, b) in this particular case.
21 log.WriteText('You selected: %s\n' % str(data.GetColour().Get()))
22
23 # Once the dialog is destroyed, Mr. wx.ColourData is no longer your
24 # friend. Don't use it again!
25 dlg.Destroy()
26
27#---------------------------------------------------------------------------
28
29
30overview = """\
31This class represents the colour chooser dialog.
32
33Use of this dialog is a multi-stage process.
34
35The actual information about how to display the dialog and the colors in the
36dialog's 'registers' are contained in a wx.ColourData instance that is created by
37the dialog at init time. Before displaying the dialog, you may alter these settings
38to suit your needs. In the example, we set the dialog up to show the extended colour
39data selection pane. Otherwise, only the more compact and less extensive colour
40dialog is shown. You may also preset the colour as well as other items.
41
42If the user selects something and selects OK, then the wx.ColourData instance contains
43the colour data that the user selected. Before destroying the dialog, retrieve the data.
44<b>Do not try to retain the wx.ColourData instance.</b> It will probably not be valid
45after the dialog is destroyed.
46
47Along with he wx.ColourDialog documentation, see also the wx.ColourData documentation
48for details.
49"""
50
51if __name__ == '__main__':
52 import sys,os
53 import run
54 run.main(['', os.path.basename(sys.argv[0])] + sys.argv[1:])
55