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