File: wx.lib.colourdb.txt

package info (click to toggle)
wxpython4.0 4.2.0%2Bdfsg-3
  • links: PTS, VCS
  • area: main
  • in suites: bookworm
  • size: 232,540 kB
  • sloc: cpp: 958,937; python: 233,059; ansic: 150,441; makefile: 51,662; sh: 8,687; perl: 1,563; javascript: 584; php: 326; xml: 200
file content (114 lines) | stat: -rw-r--r-- 3,704 bytes parent folder | download
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
.. 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.