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