AGW Logo

agw_title cubecolourdialog

CubeColourDialog is an alternative implementation of wx.ColourDialog.


description Description

The CubeColourDialog is an alternative implementation of wx.ColourDialog, and it offers different functionalities with respect to the default wxPython one. It can be used as a replacement of wx.ColourDialog with exactly the same syntax and methods.

Some features:

  • RGB components may be controlled using spin controls or with mouse gestures on a 3D RGB cube, with the 3 components laying on the X, Y, Z axes;
  • HSB components may be controlled using spin controls or with mouse gestures on a 2D colour wheel;
  • Brightness has its own vertical slider to play with;
  • The colour alpha channel can be controlled using another vertical slider, or via spin control;
  • The colour alpha channel controls can be completely hidden at startup or the choice to use the alpha channel can be left to the user while playing with the dialog, via a simple wx.CheckBox;
  • The “old colour” and “new colour” are displayed in two small custom panel, which support alpha transparency and texture;
  • CubeColourDialog displays also the HTML colour code in hexadecimal format;
  • When available, a corresponding “Web Safe” colour is generated using a 500 web colours “database” (a dictionary inside the widget source code). Web Safe colours are recognized by all the browsers;
  • When available, a corresponding “HTML name” for the selected colour is displayed, by using the same 500 web colours “database”;
  • When available, a corresponding “Microsoft Access Code” for the selected colour is displayed, by using the same 500 web colours “database”.

And much more.


usage Usage

Usage example:

import wx
import wx.lib.agw.cubecolourdialog as CCD

# Our normal wxApp-derived class, as usual
app = wx.App(0)

colourData = wx.ColourData()
dlg = CCD.CubeColourDialog(None, colourData)

if dlg.ShowModal() == wx.ID_OK:

    # If the user selected OK, then the dialog's wx.ColourData will
    # contain valid information. Fetch the data ...
    colourData = dlg.GetColourData()
    h, s, v, a = dlg.GetHSVAColour()

    # ... then do something with it. The actual colour data will be
    # returned as a three-tuple (r, g, b) in this particular case.
    colour = colourData.GetColour()
    r, g, b, alpha = colour.Red(), colour.Green(), colour.Blue(), colour.Alpha()
    print "You selected (RGBA): %d, %d, %d, %d"%(r, g, b, alpha)
    print "You selected (HSVA): %d, %d, %d, %d"%(h, s, v, a)

# Once the dialog is destroyed, Mr. wx.ColourData is no longer your
# friend. Don't use it again!
dlg.Destroy()

app.MainLoop()

This code snippet can be downloaded, see this example script.

Note

Some of the AGW snippets of code in the documentation use images and external files (to create bitmaps or access external data). As these files are not provided in these snippets, you should make the approriate modifications to the code to actually run it.


styles Window Styles

This class supports the following window styles:


Window styles for cubecolourdialog
Window Styles Hex Value Description
CCD_SHOW_ALPHA 0x1 Show the widget used to control colour alpha channels in CubeColourDialog.

events Events Processing

No custom events are available for this class.


license License And Version

CubeColourDialog is distributed under the wxPython license.

Latest Revision: Andrea Gavana @ 26 Feb 2012, 15.00 GMT

Version 0.4.

Module author: Andrea Gavana <andrea.gavana@gmail.com>


hierarchy Inheritance Diagram

Inheritance diagram for module: cubecolourdialog

Inheritance diagram of cubecolourdialog.AlphaCtrl, cubecolourdialog.BaseLineCtrl, cubecolourdialog.BasePyControl, cubecolourdialog.BrightCtrl, cubecolourdialog.Colour, cubecolourdialog.ColourPanel, cubecolourdialog.CubeColourDialog, cubecolourdialog.CustomPanel, cubecolourdialog.HSVWheel, cubecolourdialog.LineDescription, cubecolourdialog.RGBCube


svn_main SVN Revisions

A graphical representation of the SVN commits in the last year.

Click on any date in the picture to jump to that particular revision page, containing information about committers, log messages and SVN diffs.

cubecolourdialog

Revision Graph For cubecolourdialog


2to3 Python 3 Issues (via 2to3)

No issues have been detected by 2to3.py.