2
Implementation of a ButtonEditor demo plugin for Traits UI demo program.
4
This demo shows each of the two styles of the ButtonEditor.
5
(As of this writing, they are identical.)
8
from traits.api import HasTraits, Button
9
from traitsui.api import Item, View, Group
10
from traitsui.message import message
13
#-------------------------------------------------------------------------------
15
#-------------------------------------------------------------------------------
17
class ButtonEditorDemo ( HasTraits ):
18
""" This class specifies the details of the ButtonEditor demo.
21
# To demonstrate any given Trait editor, an appropriate Trait is required.
22
fire_event = Button('Click Me')
25
def _fire_event_fired():
26
message("Button clicked!")
30
# ButtonEditor display
31
# (Note that Text and ReadOnly versions are not applicable)
32
event_group = Group( Item('fire_event', style='simple', label='Simple'),
34
Item('fire_event', style='custom', label='Custom'),
36
Item(label='[text style unavailable]'),
38
Item(label='[read only style unavailable]'))
41
view1 = View( event_group,
42
title = 'ButtonEditor',
48
popup = ButtonEditorDemo()
50
# Run the demo (if invoked from the command line):
51
if __name__ == '__main__':
52
popup.configure_traits()