1
# Copyright (c) 2007, Enthought, Inc.
5
Implementation of a ColorEditor demo plugin for Traits UI demo program.
7
This demo shows each of the four styles of the ColorEditor
12
import HasTraits, RGBColor
15
import Item, Group, View
17
# Demo class definition:
18
class ColorEditorDemo ( HasTraits ):
19
""" Defines the main ColorEditor demo. """
21
# Define a Color trait to view:
22
color_trait = RGBColor
24
# Items are used to define the demo display, one item per editor style:
26
Item( 'color_trait', style = 'simple', label = 'Simple' ),
28
Item( 'color_trait', style = 'custom', label = 'Custom' ),
30
Item( 'color_trait', style = 'text', label = 'Text' ),
32
Item( 'color_trait', style = 'readonly', label = 'ReadOnly' )
38
title = 'ColorEditor',
44
demo = ColorEditorDemo()
46
# Run the demo (if invoked from the command line):
47
if __name__ == '__main__':
48
demo.configure_traits()