This control allows the user to select a colour.
The generic implementation is a button which brings up a wx.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).
This class supports the following styles:
wx.CLRP_DEFAULT_STYLE
: The default style: 0.wx.CLRP_USE_TEXTCTRL
: Creates a text control to the left of the picker button which is completely managed by the wx.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 wx.PickerBase to modify the text control.wx.CLRP_SHOW_LABEL
: Shows the colour in HTML form (AABBCC
) as colour button label (instead of no label at all).Handlers bound for the following event types will receive a wx.ColourPickerEvent parameter.
CLRP_USE_TEXTCTRL
; note that in this case the event is fired only if the user’s input is valid, i.e. recognizable).See also
__init__ |
|
Create |
Creates a colour picker with the given arguments. |
GetColour |
Returns the currently selected colour. |
SetColour |
Sets the currently selected colour. |
wx.
ColourPickerCtrl
(PickerBase)¶Possible constructors:
ColourPickerCtrl()
ColourPickerCtrl(parent, id=ID_ANY, colour=BLACK, pos=DefaultPosition,
size=DefaultSize, style=CLRP_DEFAULT_STYLE, validator=DefaultValidator,
name=ColourPickerCtrlNameStr)
This control allows the user to select a colour.
__init__
(self, *args, **kw)¶__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: |
|
---|---|
Return type: | bool |
Returns: |
|
SetColour
(self, *args, **kw)¶Sets the currently selected colour.
See wx.Colour.Set
.
SetColour (self, col)
Parameters: | col (wx.Colour) – |
---|
SetColour (self, colname)
Parameters: | colname (string) – |
---|