Module aui_utilities

Description

This module contains some common functions used by wxPython-AUI to manipulate colours, bitmaps, text and gradient shadings.

Methods

Methods API

This module contains some common functions used by wxPython-AUI to manipulate colours, bitmaps, text and gradient shadings.

BitmapFromBits(bits, w, h, color)

BitmapFromBits() is a utility function that creates a masked bitmap from raw bits (XBM format).

Parameters:
  • bits – a string containing the raw bits of the bitmap;
  • w – the bitmap width;
  • h – the bitmap height;
  • colour – the colour which will replace all white pixels in the raw bitmap.
BlendColour(fg, bg, alpha)

Blends the two colour component fg and bg into one colour component, adding an optional alpha channel.

Parameters:
  • fg – the first colour component;
  • bg – the second colour component;
  • alpha – an optional transparency value.
ChopText(dc, text, max_size)

Chops the input text if its size does not fit in max_size, by cutting the text and adding ellipsis at the end.

Parameters:
  • dc – a wx.DC device context;
  • text – the text to chop;
  • max_size – the maximum size in which the text should fit.
Clip(a, b, c)

Clips the value in a based on the extremes b and c.

Parameters:
  • a – the value to analyze;
  • b – a minimum value;
  • c – a maximum value.
DrawGradientRectangle(dc, rect, start_colour, end_colour, direction, offset=0, length=0)

Draws a gradient-shaded rectangle.

Parameters:
  • dc – a wx.DC device context;
  • rect – the rectangle in which to draw the gradient;
  • start_colour – the first colour of the gradient;
  • end_colour – the second colour of the gradient;
  • direction – the gradient direction (horizontal or vertical).
GetBaseColour()
Returns the face shading colour on push buttons/backgrounds.
IndentPressedBitmap(rect, button_state)

Indents the input rectangle rect based on the value of button_state.

Parameters:
  • rect – an instance of wx.Rect;
  • button_state – an AuiNotebook button state.
LightColour(color, percent)

Brighten input colour by percent.

Parameters:
  • colour – the colour to be brightened;
  • percent – brightening percentage.
LightContrastColour(c)

Creates a new, lighter colour based on the input colour c.

Parameter:c – the input colour to analyze.
MakeDisabledBitmap(bitmap)

Convert the given image (in place) to a grayed-out version, appropriate for a ‘disabled’ appearance.

Param:bitmap: the bitmap to gray-out.
MakeGray((r, g, b), factor, maskColor)

Make a pixel grayed-out. If the pixel matches the maskColor, it won’t be changed.

Parameters:
  • (r,g,b) – a tuple representing a pixel colour;
  • factor – a graying-out factor;
  • maskColor – a colour mask.
PaneCreateStippleBitmap()
Creates a stipple bitmap to be used in a wx.Brush. This is used to draw sash resize hints.
StepColour(c, ialpha)

Darken/lighten the input colour c.

Parameters:
  • c – a colour to darken/lighten;
  • ialpha – a transparency value.

Table Of Contents

Previous topic

wxPython-AUI Reference Documentation

Next topic

Module auibar

This Page