Table Of Contents

Previous topic

ColourDialog

Next topic

ColourPickerEvent

This Page

phoenix_title ColourPickerCtrl

This control allows the user to select a colour.

The generic implementation is a button which brings up a ColourDialog when clicked. Native implementation may differ but this is usually a (small) widget which give access to the colour-chooser dialog. It is only available if USE_COLOURPICKERCTRL is set to 1 (the default).

styles Window Styles

This class supports the following styles:

  • CLRP_DEFAULT_STYLE: The default style: 0.
  • CLRP_USE_TEXTCTRL: Creates a text control to the left of the picker button which is completely managed by the ColourPickerCtrl and which can be used by the user to specify a colour (see SetColour). The text control is automatically synchronized with button’s value. Use functions defined in PickerBase to modify the text control.
  • CLRP_SHOW_LABEL: Shows the colour in HTML form (AABBCC) as colour button label (instead of no label at all).

events Events Emitted by this Class

Handlers bound for the following event types will receive a ColourPickerEvent parameter.

  • EVT_COLOURPICKER_CHANGED: The user changed the colour selected in the control either using the button or using text control (see CLRP_USE_TEXTCTRL ; note that in this case the event is fired only if the user’s input is valid, i.e. recognizable).

class_hierarchy Inheritance Diagram

Inheritance diagram for class ColourPickerCtrl

Inheritance diagram of ColourPickerCtrl


appearance Control Appearance


wxMSW

wxMSW

wxMAC

wxMAC

wxGTK

wxGTK


method_summary Methods Summary

__init__  
Create Creates a colour picker with the given arguments.
GetColour Returns the currently selected colour.
SetColour Sets the currently selected colour.

property_summary Properties Summary

Colour See GetColour and SetColour

api Class API



class ColourPickerCtrl(PickerBase)

This control allows the user to select a colour.

Possible constructors:

ColourPickerCtrl()

ColourPickerCtrl(parent, id=ID_ANY, colour=BLACK, pos=DefaultPosition,
                 size=DefaultSize, style=CLRP_DEFAULT_STYLE, validator=DefaultValidator,
                 name=ColourPickerCtrlNameStr)

Methods



__init__(self, *args, **kw)

overload Overloaded Implementations:



__init__ (self)



__init__ (self, parent, id=ID_ANY, colour=BLACK, pos=DefaultPosition, size=DefaultSize, style=CLRP_DEFAULT_STYLE, validator=DefaultValidator, name=ColourPickerCtrlNameStr)

Initializes the object and calls Create with all the parameters.

Parameters:





Create(self, parent, id=ID_ANY, colour=BLACK, pos=DefaultPosition, size=DefaultSize, style=CLRP_DEFAULT_STYLE, validator=DefaultValidator, name=ColourPickerCtrlNameStr)

Creates a colour picker with the given arguments.

Parameters:
  • parent (Window) – Parent window, must not be not None.
  • id (int) – The identifier for the control.
  • colour (Colour) – The initial colour shown in the control.
  • pos (Point) – Initial position.
  • size (Size) – Initial size.
  • style (long) – The window style, see CRLP_ flags.
  • validator (Validator) – Validator which can be used for additional date checks.
  • name (string) – Control name.
Return type:

bool

Returns:

True if the control was successfully created or False if creation failed.



GetColour(self)

Returns the currently selected colour.

Return type: Colour


SetColour(self, *args, **kw)

Sets the currently selected colour.

See Colour.Set .


overload Overloaded Implementations:



SetColour (self, col)

Parameters:col (Colour) –



SetColour (self, colname)

Parameters:colname (string) –




Properties



Colour

See GetColour and SetColour