1
# Copyright (c) 2007, Enthought, Inc.
5
This program demonstrates hows how to add an event handler which performs an
6
action when the 'Apply' or 'Revert' buttons are pressed.
11
import HasTraits, Str, List
14
import Item, View, Handler, HGroup, VGroup
16
# 'ApplyRevert_Handler' class:
17
class ApplyRevert_Handler ( Handler ):
19
def apply ( self, info ):
21
object.stack.insert( 0, object.input )
22
object.queue.append( object.input )
24
def revert ( self, info ):
25
# Do something exciting here...
26
print 'revert called...'
28
# 'ApplyRevertDemo' class:
29
class ApplyRevertDemo ( HasTraits ):
36
# Traits view definitions:
69
title = 'Apply/Revert example',
70
buttons = [ 'Apply', 'Revert' ],
72
handler = ApplyRevert_Handler
76
modal_popup = ApplyRevertDemo()
78
# Run the demo (if invoked from the command line):
79
if __name__ == '__main__':
80
modal_popup.configure_traits()