Custom Controls → ColourSelect

Overview = """\

A coloured button that when clicked allows the user to select a colour
from the wxColourDialog.

"""
   
   
import wx
import wx.lib.colourselect as colourselect
class Frame(wx.Frame):

def __init__(
  self, parent=None, id=wx.ID_ANY, title='ColourSelect', pos=wx.DefaultPosition,
  size=wx.DefaultSize, style=wx.DEFAULT_FRAME_STYLE
  ):
  
  wx.Frame.__init__(self, parent, id, title, pos, size, style)
  self.SetIcon(wx.Icon('wxWidgets.ico', wx.BITMAP_TYPE_ICO))
  
  
  panel = wx.Panel(self, wx.ID_ANY)
  
  colourSelect = colourselect.ColourSelect(panel, wx.ID_ANY, 'Colour',
                                           pos=(60, 60))
  
  
  sizer = wx.BoxSizer()
  sizer.Add(colourSelect)
  panel.SetSizer(sizer)
  
  
  
def TestFrame():
app = wx.PySimpleApp()
frame = Frame(size=(640, 480))
frame.Centre()
frame.Show()
app.MainLoop()


if __name__ == '__main__':
TestFrame()