Home | Trees | Index | Help |
|
---|
Package wx :: Class Colour |
|
object
--+ |Object
--+ | Colour
A colour is an object representing a combination of Red, Green, and Blue (RGB) intensity values, and is used to determine drawing colours, window colours, etc. Valid RGB values are in the range 0 to 255.
In wxPython there are typemaps that will automatically convert from a colour name, from a '#RRGGBB' colour hex value string, or from a 3 integer tuple to a wx.Colour object when calling C++ methods that expect a wxColour. This means that the following are all equivallent:
win.SetBackgroundColour(wxColour(0,0,255)) win.SetBackgroundColour('BLUE') win.SetBackgroundColour('#0000FF') win.SetBackgroundColour((0,0,255))
Additional colour names and their coresponding values can be added
using wx.ColourDatabase
. Various system colours (as set in the
user's system preferences) can be retrieved with
wx.SystemSettings.GetColour
.
Method Summary | |
---|---|
Colour |
Constructs a colour from red, green and blue values. |
__del__(self)
| |
bool |
Compare colours for equality. |
__getitem__(self,
index)
| |
__len__(self)
| |
bool |
Compare colours for inequality. |
__nonzero__(self)
| |
__reduce__(self)
| |
__repr__(self)
| |
__str__(self)
| |
byte |
Returns the Alpha value. |
asTuple is deprecated, use Get instead | |
byte |
Returns the blue intensity. |
(r, g, b) |
Returns the RGB intensity values as a tuple. |
String |
Return the colour as a string. |
long |
Returns a pixel value which is platform-dependent. |
unsigned long |
Return the colour as a packed RGB value |
byte |
Returns the green intensity. |
bool |
Returns True if the colour object is valid (the colour has been initialised with RGB values). |
bool |
Returns True if the colour object is valid (the colour has been initialised with RGB values). |
byte |
Returns the red intensity. |
Sets the RGB intensity values. | |
Sets the RGB intensity values using a colour name listed in wx.TheColourDatabase. | |
SetRGB(self, unsigned long colRGB) |
Property Summary | |
---|---|
Pixel : See GetPixel | |
RGB : See GetRGB and SetRGB | |
thisown : The membership flag |
Class Variable Summary | |
---|---|
bool |
__safe_for_unpickling__ = True
|
Method Details |
---|
__init__(self,
red=0,
green=0,
blue=0,
alpha=ALPHA_OPAQUE)
|
__eq__(self,
other)
|
__ne__(self, other)Compare colours for inequality.
|
Alpha(self)Returns the Alpha value.
|
asTuple(*args, **kwargs)asTuple is deprecated, use |
Blue(self)Returns the blue intensity.
|
Get()Returns the RGB intensity values as a tuple.
|
GetAsString(self, flags=wxC2S_NAME|wxC2S_CSS_SYNTAX)Return the colour as a string. Acceptable flags are:
|
GetPixel(self)Returns a pixel value which is platform-dependent. On Windows, a COLORREF is returned. On X, an allocated pixel value is returned. -1 is returned if the pixel is invalid (on X, unallocated).
|
GetRGB(self)Return the colour as a packed RGB value
|
Green(self)Returns the green intensity.
|
IsOk(self)Returns True if the colour object is valid (the colour has been initialised with RGB values).
|
Ok(self)Returns True if the colour object is valid (the colour has been initialised with RGB values).
|
Red(self)Returns the red intensity.
|
Set(self, red, green, blue, alpha=ALPHA_OPAQUE)Sets the RGB intensity values.
|
SetFromName(self, colourName)Sets the RGB intensity values using a colour name listed in wx.TheColourDatabase.
|
SetRGB(*args, **kwargs)SetRGB(self, unsigned long colRGB) Sets the RGB intensity values from a packed RGB value. |
Property Details |
---|
PixelSee
|
RGB |
thisownThe membership flag |
Class Variable Details |
---|
__safe_for_unpickling__
|
Home | Trees | Index | Help |
|
---|
Generated by Epydoc 2.1.20050511.rpd on Thu Mar 22 12:11:41 2007 | http://epydoc.sf.net |