]> git.saurik.com Git - wxWidgets.git/blob - wxPython/demo/ColourDialog.py
Rename the grid selection mode flags
[wxWidgets.git] / wxPython / demo / ColourDialog.py
1 # 11/15/2003 - Jeff Grimmett (grimmtooth@softhome.net)
2 #
3 # o Updated for wx namespace
4 #
5
6 import wx
7
8 #---------------------------------------------------------------------------
9
10 def 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
34 overview = """\
35 This class represents the colour chooser dialog.
36
37 Use of this dialog is a multi-stage process.
38
39 The actual information about how to display the dialog and the colors in the
40 dialog's 'registers' are contained in a wx.ColourData instance that is created by
41 the dialog at init time. Before displaying the dialog, you may alter these settings
42 to suit your needs. In the example, we set the dialog up to show the extended colour
43 data selection pane. Otherwise, only the more compact and less extensive colour
44 dialog is shown. You may also preset the colour as well as other items.
45
46 If the user selects something and selects OK, then the wxColourData instance contains
47 the 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
49 after the dialog is destroyed.
50
51 Along with he wxColourDialog documentation, see also the wx.ColourData documentation
52 for details.
53 """
54
55 if __name__ == '__main__':
56 import sys,os
57 import run
58 run.main(['', os.path.basename(sys.argv[0])])
59