File: wx.lib.colourchooser.pycolourchooser.PyColourChooser.txt

package info (click to toggle)
wxpython4.0 4.0.4%2Bdfsg-2
  • links: PTS, VCS
  • area: main
  • in suites: buster
  • size: 211,112 kB
  • sloc: cpp: 888,355; python: 223,130; makefile: 52,087; ansic: 45,780; sh: 3,012; xml: 1,534; perl: 264
file content (266 lines) | stat: -rw-r--r-- 11,073 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
171
172
173
174
175
176
177
178
179
180
181
182
183
184
185
186
187
188
189
190
191
192
193
194
195
196
197
198
199
200
201
202
203
204
205
206
207
208
209
210
211
212
213
214
215
216
217
218
219
220
221
222
223
224
225
226
227
228
229
230
231
232
233
234
235
236
237
238
239
240
241
242
243
244
245
246
247
248
249
250
251
252
253
254
255
256
257
258
259
260
261
262
263
264
265
266
.. wxPython Phoenix documentation

   This file was generated by Phoenix's sphinx generator and associated
   tools, do not edit by hand.

   Copyright: (c) 2011-2018 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

   <div id="toggleBlock" onclick="return toggleVisibility(this)" class="closed" style="cursor:pointer;">
   <img id="toggleBlock-trigger" src="_static/images/closed.png"/>
   Inheritance diagram for class <strong>PyColourChooser</strong>:
   </div>
   <div id="toggleBlock-summary" style="display:block;"></div>
   <div id="toggleBlock-content" style="display:none;">
   <p class="graphviz">
   <center><img src="_static/images/inheritance/wx.lib.colourchooser.pycolourchooser.PyColourChooser_inheritance.png" alt="Inheritance diagram of PyColourChooser" usemap="#dummy" class="inheritance"/></center>
   </div>
   <script type="text/javascript">toggleVisibilityOnLoad(document.getElementById('toggleBlock'))</script>
   <map id="dummy" name="dummy"> <area shape="rect" id="node1" href="wx.Panel.html" title="wx.Panel" alt="" coords="153,315,228,344"/> <area shape="rect" id="node7" href="wx.lib.colourchooser.pycolourchooser.PyColourChooser.html" title="wx.lib.colourchooser.pycolourchooser.PyColourChooser" alt="" coords="5,392,376,421"/> <area shape="rect" id="node2" href="wx.Window.html" title="wx.Window" alt="" coords="146,237,235,267"/> <area shape="rect" id="node3" href="wx.Trackable.html" title="wx.Trackable" alt="" coords="83,5,184,35"/> <area shape="rect" id="node4" href="wx.EvtHandler.html" title="wx.EvtHandler" alt="" coords="135,83,245,112"/> <area shape="rect" id="node6" href="wx.WindowBase.html" title="wx.WindowBase" alt="" coords="130,160,251,189"/> <area shape="rect" id="node5" href="wx.Object.html" title="wx.Object" alt="" coords="208,5,289,35"/> </map> 
   </p>

|


|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.