.. wxPython Phoenix documentation
This file was generated by Phoenix's sphinx generator and associated
tools, do not edit by hand.
Copyright: (c) 2011-2020 by Total Control Software
License: wxWindows License
.. include:: headings.inc
.. currentmodule:: wx.lib.colourchooser.pycolourchooser
.. highlight:: python
.. _wx.lib.colourchooser.pycolourchooser.PyColourChooser:
==========================================================================================================================================
|phoenix_title| **wx.lib.colourchooser.pycolourchooser.PyColourChooser**
==========================================================================================================================================
A Pure-Python implementation of the colour chooser dialog.
The PyColourChooser is a pure python implementation of the colour
chooser dialog. It's useful for embedding the colour choosing functionality
inside other widgets, when the pop-up dialog is undesirable. It can also
be used as a drop-in replacement on the GTK platform, as the native
dialog is kind of ugly.
|
|class_hierarchy| Class Hierarchy
=================================
.. raw:: html

Inheritance diagram for class
PyColourChooser:
|
|appearance| Control Appearance
===============================
|
.. container:: control-appearance-figures
.. figure:: _static/images/widgets/fullsize/wxmsw/wx.lib.colourchooser.pycolourchooser.pycolourchooser.png
:alt: wxMSW
:figclass: appearance-figure
**wxMSW**
.. figure:: _static/images/widgets/fullsize/wxmac/../no_appearance.png
:alt: wxMAC
:figclass: appearance-figure
**wxMAC**
.. figure:: _static/images/widgets/fullsize/wxgtk/wx.lib.colourchooser.pycolourchooser.pycolourchooser.png
:alt: wxGTK
:figclass: appearance-figure
**wxGTK**
|
|super_classes| Known Superclasses
==================================
:class:`wx.Panel`
|
|method_summary| Methods Summary
================================
=================================================================================== ================================================================================
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.__init__` Creates an instance of the colour chooser. Note that it is best to
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.colourToHSV` Convert wx.Colour to hsv triplet
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.doPaletteClick` Updates the colour values based on the mouse location
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.getColourFromControls` Calculate current colour from HS box position and V slider.
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.GetValue` Returns a wxColour object indicating the current colour choice.
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.getValueAsFloat` If you type garbage, you get, literally, nothing (0)
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.getVFromSlider` Get the current value of "V" from the v slider.
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.hsvToColour` Convert hsv triplet to wx.Colour
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.InitColours` Initializes the pre-set palette colours.
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onAddCustom` Adds a custom colour to the custom colour box set. Boxes are
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onBasicClick` Highlights the selected colour box and updates the solid colour
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onColourSliderClick` Shared helper for onSliderDown()/onSliderMotion()
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onCustomClick` Highlights the selected custom colour box and updates the solid
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onHSVKillFocus`
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onPaletteCaptureLost`
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onPaletteDown` Stores state that the mouse has been pressed and updates
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onPaletteMotion` Updates the colour values during mouse motion while the
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onPaletteUp` Stores state that the mouse is no longer depressed.
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onRGBKillFocus`
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onScroll` Updates the display to reflect the new "Value".
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onSliderDown` Handle mouse click on the colour slider palette
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onSliderMotion` Handle mouse-down drag on the colour slider palette
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.onSliderUp`
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.setCustomColour` Sets the custom colour at the given index. true_colour is wxColour
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.setSliderToV` Set a new HSV value for the v slider. Does not update displayed colour.
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.SetValue` Updates the colour chooser to reflect the given wxColour.
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.UpdateColour` Updates displayed colour and HSV controls with the new colour
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.updateDisplayColour` Update the displayed color box (solid) and send the EVT_COLOUR_CHANGED
:meth:`~wx.lib.colourchooser.pycolourchooser.PyColourChooser.UpdateEntries` Updates the color levels to display the new values.
=================================================================================== ================================================================================
|
|api| Class API
===============
.. class:: PyColourChooser(wx.Panel)
A Pure-Python implementation of the colour chooser dialog.
The PyColourChooser is a pure python implementation of the colour
chooser dialog. It's useful for embedding the colour choosing functionality
inside other widgets, when the pop-up dialog is undesirable. It can also
be used as a drop-in replacement on the GTK platform, as the native
dialog is kind of ugly.
.. method:: __init__(self, parent, id)
Creates an instance of the colour chooser. Note that it is best to
accept the given size of the colour chooser as it is currently not
resizeable.
.. method:: colourToHSV(self, colour)
Convert wx.Colour to hsv triplet
.. method:: doPaletteClick(self, m_x, m_y)
Updates the colour values based on the mouse location
over the palette.
.. method:: getColourFromControls(self)
Calculate current colour from HS box position and V slider.
return - wx.Colour
.. method:: GetValue(self)
Returns a wxColour object indicating the current colour choice.
.. method:: getValueAsFloat(self, textctrl)
If you type garbage, you get, literally, nothing (0)
.. method:: getVFromSlider(self)
Get the current value of "V" from the v slider.
.. method:: hsvToColour(self, hsv)
Convert hsv triplet to wx.Colour
.. method:: InitColours(self)
Initializes the pre-set palette colours.
.. method:: onAddCustom(self, event)
Adds a custom colour to the custom colour box set. Boxes are
chosen in a round-robin fashion, eventually overwriting previously
added colours.
.. method:: onBasicClick(self, event, box)
Highlights the selected colour box and updates the solid colour
display and colour slider to reflect the choice.
.. method:: onColourSliderClick(self, y)
Shared helper for onSliderDown()/onSliderMotion()
.. method:: onCustomClick(self, event, box)
Highlights the selected custom colour box and updates the solid
colour display and colour slider to reflect the choice.
.. method:: onHSVKillFocus(self, event)
.. method:: onPaletteCaptureLost(self, event)
.. method:: onPaletteDown(self, event)
Stores state that the mouse has been pressed and updates
the selected colour values.
.. method:: onPaletteMotion(self, event)
Updates the colour values during mouse motion while the
mouse button is depressed.
.. method:: onPaletteUp(self, event)
Stores state that the mouse is no longer depressed.
.. method:: onRGBKillFocus(self, event)
.. method:: onScroll(self, event)
Updates the display to reflect the new "Value".
.. method:: onSliderDown(self, event)
Handle mouse click on the colour slider palette
.. method:: onSliderMotion(self, event)
Handle mouse-down drag on the colour slider palette
.. method:: onSliderUp(self, event)
.. method:: setCustomColour (self, index, true_colour, base_colour, slidepos)
Sets the custom colour at the given index. true_colour is wxColour
object containing the actual rgb value of the custom colour.
base_colour (wxColour) and slidepos (int) are used to configure the
colour slider and set everything to its original position.
.. method:: setSliderToV(self, v)
Set a new HSV value for the v slider. Does not update displayed colour.
.. method:: SetValue(self, colour)
Updates the colour chooser to reflect the given wxColour.
.. method:: UpdateColour(self, colour)
Updates displayed colour and HSV controls with the new colour
.. method:: updateDisplayColour(self, colour)
Update the displayed color box (solid) and send the EVT_COLOUR_CHANGED
.. method:: UpdateEntries(self, colour)
Updates the color levels to display the new values.