.. wxPython Phoenix documentation This file was generated by Phoenix's sphinx generator and associated tools, do not edit by hand. Copyright: (c) 2011-2020 by Total Control Software License: wxWindows License .. include:: headings.inc .. module:: wx.lib.colourdb .. currentmodule:: wx.lib.colourdb .. highlight:: python .. _wx.lib.colourdb: ========================================================================================================================================== |phoenix_title| **wx.lib.colourdb** ========================================================================================================================================== This module loads additional colour names/values into the :class:`wx.ColourDatabase`. Description =========== This module loads additional colour names/values into the :class:`wx.ColourDatabase`. The :mod:`wx.Colourdb` will update the wxPython :class:`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 ==================================== ================================================================================ ================================================================================ :func:`~wx.lib.colourdb.getColourInfoList` Returns the list of colour name/value tuples used by this module. :func:`~wx.lib.colourdb.getColourList` Returns a list of just the colour names used by this module. :func:`~wx.lib.colourdb.updateColourDB` Updates the :class:`wx.ColourDatabase` by adding new colour names and RGB values. ================================================================================ ================================================================================ | Functions ------------ .. function:: getColourInfoList() Returns the list of colour name/value tuples used by this module. :rtype: list of tuples .. function:: getColourList() Returns a list of just the colour names used by this module. :rtype: list of strings .. function:: updateColourDB() Updates the :class:`wx.ColourDatabase` by adding new colour names and RGB values.