1
# Copyright (c) 2007, Enthought, Inc.
5
Implementation of an ImageEnumEditor demo plugin for the Traits UI demo program.
7
This demo shows each of the four styles of the ImageEnumEditor.
12
import HasTraits, Str, Trait
15
import Item, Group, View, ImageEnumEditor
17
# This list of image names (with the standard suffix "_origin") is used to
18
# construct an image enumeration trait to demonstrate the ImageEnumEditor:
19
image_list = [ 'top left', 'top right', 'bottom left', 'bottom right' ]
21
class Dummy ( HasTraits ):
22
""" Dummy class for ImageEnumEditor
28
class ImageEnumEditorDemo ( HasTraits ):
29
""" Defines the ImageEnumEditor demo class.
32
# Define a trait to view:
33
image_from_list = Trait( editor = ImageEnumEditor( values = image_list,
40
# Items are used to define the demo display, one Item per editor style:
42
Item( 'image_from_list', style = 'simple', label = 'Simple' ),
44
Item( 'image_from_list', style = 'custom', label = 'Custom' ),
46
Item( 'image_from_list', style = 'text', label = 'Text' ),
48
Item( 'image_from_list', style = 'readonly', label = 'ReadOnly' )
54
title = 'ImageEnumEditor',
60
demo = ImageEnumEditorDemo()
62
# Run the demo (if invoked from the command line):
63
if __name__ == '__main__':
64
demo.configure_traits()