phoenix_title wx.lib.colourdb

This module loads additional colour names/values into the wx.ColourDatabase.

Description

This module loads additional colour names/values into the wx.ColourDatabase.

The wx.Colourdb will update the wxPython wx.ColourDatabase using a pre-defined set of colour names/colour tuples, hard-coded in this module source code.

Usage

Sample usage:

import wx
import wx.lib.colourdb

class MyFrame(wx.Frame):
    def __init__(self, parent, title):
        wx.Frame.__init__(self, parent, wx.ID_ANY, title, size=(400, 300))
        # show the selected colour in this panel
        self.panel = wx.Panel(self)

        wx.lib.colourdb.updateColourDB()
        # create a colour list from the colourdb database
        colour_list = wx.lib.colourdb.getColourList()

        # create a choice widget
        self.choice = wx.Choice(self.panel, -1, choices=colour_list)
        # select item 0 (first item) in choice list to show
        self.choice.SetSelection(0)
        # set the current frame colour to the choice
        self.SetBackgroundColour(self.choice.GetStringSelection())
        # bind the checkbox events to an action
        self.choice.Bind(wx.EVT_CHOICE, self.OnChoice)


    def OnChoice(self, event):
        bgcolour = self.choice.GetStringSelection()
        # change colour of the panel to the selected colour ...
        self.panel.SetBackgroundColour(bgcolour)
        self.panel.Refresh()
        # show the selected colour in the frame title
        self.SetTitle(bgcolour.lower())

app = wx.App()
frame = MyFrame(None, 'Select a colour')
frame.Show()
app.MainLoop()

function_summary Functions Summary

getColourInfoList

Returns the list of colour name/value tuples used by this module.

getColourList

Returns a list of just the colour names used by this module.

updateColourDB

Updates the wx.ColourDatabase by adding new colour names and RGB values.


Functions



getColourInfoList()

Returns the list of colour name/value tuples used by this module.

Return type:

list of tuples



getColourList()

Returns a list of just the colour names used by this module.

Return type:

list of strings



updateColourDB()

Updates the wx.ColourDatabase by adding new colour names and RGB values.