1
# Copyright (c) 2007, Enthought, Inc.
5
Implemention of a ListEditor demo plugin for Traits UI demo program
7
This demo shows each of the four styles of ListEditor
12
import HasTraits, List, Str
15
import Item, Group, View
17
# Define the demo class:
18
class ListEditorDemo ( HasTraits ):
19
""" Defines the main ListEditor demo class. """
21
# Define a List trait to display:
22
play_list = List( Str, [ "The Merchant of Venice", "Hamlet", "MacBeth" ] )
24
# Items are used to define display, one per editor style:
26
Item( 'play_list', style = 'simple', label = 'Simple', height = 75 ),
28
Item( 'play_list', style = 'custom', label = 'Custom' ),
30
Item( 'play_list', style = 'text', label = 'Text' ),
32
Item( 'play_list', style = 'readonly', label = 'ReadOnly' )
44
demo = ListEditorDemo()
46
# Run the demo (if invoked from the command line):
47
if __name__ == '__main__':
48
demo.configure_traits()