Package wx :: Package lib :: Package colourchooser :: Module pycolourchooser :: Class PyColourChooser
[frames | no frames]

Type PyColourChooser

object --+                
         |                
    Object --+            
             |            
    EvtHandler --+        
                 |        
            Window --+    
                     |    
                 Panel --+
                         |
                        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.


Method Summary
  __init__(self, parent, id)
Creates an instance of the colour chooser.
  doPaletteClick(self, m_x, m_y)
Updates the colour values based on the mouse location over the palette.
  GetValue(self)
Returns a wxColour object indicating the current colour choice.
  InitColours(self)
Initializes the pre-set palette colours.
  onAddCustom(self, event)
Adds a custom colour to the custom colour box set.
  onBasicClick(self, event, box)
Highlights the selected colour box and updates the solid colour display and colour slider to reflect the choice.
  onCustomClick(self, event, box)
Highlights the selected custom colour box and updates the solid colour display and colour slider to reflect the choice.
  onPaletteDown(self, event)
Stores state that the mouse has been pressed and updates the selected colour values.
  onPaletteMotion(self, event)
Updates the colour values during mouse motion while the mouse button is depressed.
  onPaletteUp(self, event)
Stores state that the mouse is no longer depressed.
  onScroll(self, event)
Updates the solid colour display to reflect the changing slider.
  setCustomColour(self, index, true_colour, base_colour, slidepos)
Sets the custom colour at the given index.
  SetValue(self, colour)
Updates the colour chooser to reflect the given wxColour.
  UpdateColour(self, colour)
Performs necessary updates for when the colour selection has changed.
  UpdateEntries(self, colour)
Updates the color levels to display the new values.

Property Summary

Class Variable Summary
list colour_names = ['ORANGE', 'GOLDENROD', 'WHEAT', 'SPRING ...
list custom_colours = [(wx.Colour(255, 255, 255, 255), 86), (...
int idADD_CUSTOM = 129                                                                   
int idSCROLL = 130                                                                   
int last_custom = 0                                                                     
int NO_CUSTOM_COLOURS = 16                                                                    

Instance Method Details

__init__(self, parent, id)
(Constructor)

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.

Overrides:
wx.Panel.__init__

doPaletteClick(self, m_x, m_y)

Updates the colour values based on the mouse location over the palette.

GetValue(self)

Returns a wxColour object indicating the current colour choice.

InitColours(self)

Initializes the pre-set palette colours.

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.

onBasicClick(self, event, box)

Highlights the selected colour box and updates the solid colour display and colour slider to reflect the choice.

onCustomClick(self, event, box)

Highlights the selected custom colour box and updates the solid colour display and colour slider to reflect the choice.

onPaletteDown(self, event)

Stores state that the mouse has been pressed and updates the selected colour values.

onPaletteMotion(self, event)

Updates the colour values during mouse motion while the mouse button is depressed.

onPaletteUp(self, event)

Stores state that the mouse is no longer depressed.

onScroll(self, event)

Updates the solid colour display to reflect the changing slider.

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.

SetValue(self, colour)

Updates the colour chooser to reflect the given wxColour.

UpdateColour(self, colour)

Performs necessary updates for when the colour selection has changed.

UpdateEntries(self, colour)

Updates the color levels to display the new values.


Class Variable Details

colour_names

Type:
list
Value:
['ORANGE',
 'GOLDENROD',
 'WHEAT',
 'SPRING GREEN',
 'SKY BLUE',
 'SLATE BLUE',
 'MEDIUM VIOLET RED',
 'PURPLE',
...                                                                    

custom_colours

Type:
list
Value:
[(wx.Colour(255, 255, 255, 255), 86),
 (wx.Colour(255, 255, 255, 255), 86),
 (wx.Colour(255, 255, 255, 255), 86),
 (wx.Colour(255, 255, 255, 255), 86),
 (wx.Colour(255, 255, 255, 255), 86),
 (wx.Colour(255, 255, 255, 255), 86),
 (wx.Colour(255, 255, 255, 255), 86),
 (wx.Colour(255, 255, 255, 255), 86),
...                                                                    

idADD_CUSTOM

Type:
int
Value:
129                                                                   

idSCROLL

Type:
int
Value:
130                                                                   

last_custom

Type:
int
Value:
0                                                                     

NO_CUSTOM_COLOURS

Type:
int
Value:
16                                                                    

Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:10:34 2007 http://epydoc.sf.net